Skip to content

Commit

Permalink
Versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
coatless committed Jun 15, 2024
1 parent 909f0c3 commit 088bbd2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions _extensions/webr/webr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ local function writeWebRWorker()
writeFile(contents, "webr-worker.js")
end

local function specifyBaseUrl()
if baseVersionWebR == "latest" then
baseUrl = baseUrl .. "latest/"
else
baseUrl = baseUrl .. "v" .. baseVersionWebR .. "/"
end
end

--- Parse the different webr options set in the YAML frontmatter, e.g.
---
--- ```yaml
Expand All @@ -236,6 +244,7 @@ function setWebRInitializationOptions(meta)

-- Does this exist? If not, just return meta as we'll just use the defaults.
if isVariableEmpty(webr) then
specifyBaseUrl()
return meta
end

Expand All @@ -255,11 +264,7 @@ function setWebRInitializationOptions(meta)
baseVersionWebR = pandoc.utils.stringify(webr["version"])
end

if baseVersionWebR == "latest" then
baseUrl = baseUrl .. "latest/"
else
baseUrl = baseUrl .. "v" .. baseVersionWebR .. "/"
end
specifyBaseUrl()

-- The base URL used for downloading R WebAssembly binaries
-- https://webr.r-wasm.org/[version]/webr.mjs
Expand Down

0 comments on commit 088bbd2

Please sign in to comment.