diff --git a/news/changelog-1.7.md b/news/changelog-1.7.md index f96546d234..e9d7589e4e 100644 --- a/news/changelog-1.7.md +++ b/news/changelog-1.7.md @@ -30,6 +30,7 @@ All changes included in 1.7: This also provides a new public function `quarto.utils.is_empty_node` that allows to check whether a node is empty, i.e., whether it's an empty list, has no child nodes, and contains no text. +- ([#11699](https://github.com/quarto-dev/quarto-cli/issues/11699)): Fix crash with `video` shortcode inside HTML comments. - Expose new `quarto.paths.tinytex_bin_dir` in Quarto's Lua API. If TinyTeX is found by Quarto, this will be set to the path to the `bin` directory of the TinyTeX installation where command line tool are located (e.g., `pdflatex`, `tlmgr`, etc.). If TinyTeX is not found, this will be `nil`, meaning Quarto will use the system PATH to find the command line tools. ## Other Fixes and Improvements diff --git a/src/resources/extensions/quarto/video/video.lua b/src/resources/extensions/quarto/video/video.lua index 35cb432287..e18d7a6186 100644 --- a/src/resources/extensions/quarto/video/video.lua +++ b/src/resources/extensions/quarto/video/video.lua @@ -237,9 +237,16 @@ function htmlVideo(src, height, width, title, start, aspectRatio) -- https://github.com/quarto-dev/quarto-cli/issues/6833 -- handle partially-specified width, height, and aspectRatio if aspectRatio then - local strs = splitString(aspectRatio, 'x') - wr = tonumber(strs[1]) - hr = tonumber(strs[2]) + -- https://github.com/quarto-dev/quarto-cli/issues/11699#issuecomment-2549219533 + -- we remove quotes as a + -- local workaround for inconsistent shortcode argument parsing on our end. + -- + -- removing quotes in general is not a good idea, but the + -- only acceptable values for aspectRatio are 4x3, 16x9, 21x9, 1x1 + -- and so we can safely remove quotes in this context. + local strs = splitString(aspectRatio:gsub('"', ''):gsub("'", ''), 'x') + local wr = tonumber(strs[1]) + local hr = tonumber(strs[2]) local aspectRatioNum = wr / hr if height and not width then width = math.floor(height * aspectRatioNum + 0.5) diff --git a/tests/docs/smoke-all/2024/12/17/issue-11699.qmd b/tests/docs/smoke-all/2024/12/17/issue-11699.qmd new file mode 100644 index 0000000000..827343db87 --- /dev/null +++ b/tests/docs/smoke-all/2024/12/17/issue-11699.qmd @@ -0,0 +1,9 @@ +--- +title: "Video embedding in an HTML comment" +--- + +