Skip to content

Commit

Permalink
feat(lua): When possible, use Quarto Lua API from Quarto 1.5.32+ to g…
Browse files Browse the repository at this point in the history
…et the path to quarto (#51)

Co-authored-by: Barret Schloerke <[email protected]>
  • Loading branch information
cderv and schloerke authored May 14, 2024
1 parent 213a995 commit 7f0b6b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions _extensions/quarto-ext/shinylive/_extension.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: shinylive
title: Embedded Shinylive applications
author: Winston Chang
version: 0.1.0
quarto-required: ">=1.2.198"
version: 0.2.0
quarto-required: ">= 1.2.198"
contributes:
filters:
- shinylive.lua
12 changes: 11 additions & 1 deletion _extensions/quarto-ext/shinylive/shinylive.lua
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ function getShinyliveBaseDeps(language)
return deps
end

-- Legacy quarto cli location
quarto_cli_path = "quarto"
if quarto.config ~= nil and quarto.config.cli_path ~= nil then
-- * 2024/05/03 - Christophe:
-- `quarto run` needs to be called using the same quarto CLI that called the extension.
-- This is done by using `quarto.config.cli_path()` from Quarto 1.5 Lua API.
-- https://github.com/quarto-dev/quarto-cli/pull/9576
quarto_cli_path = quarto.config.cli_path()
end

return {
{
CodeBlock = function(el)
Expand All @@ -415,7 +425,7 @@ return {

-- Convert code block to JSON string in the same format as app.json.
local parsedCodeblockJson = pandoc.pipe(
"quarto",
quarto_cli_path,
{ "run", codeblockScript, language },
el.text
)
Expand Down

0 comments on commit 7f0b6b7

Please sign in to comment.