From 197bac2d65734a2425eaeaa462fca6ef6d0765a0 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Tue, 17 Dec 2024 14:55:50 -0700 Subject: [PATCH 1/3] work around inconsistent parsing in text shortcode context --- src/resources/extensions/quarto/video/video.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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) From f1e2f2cb78728d3e82c31cd85d23eedda4f4ac8f Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Tue, 17 Dec 2024 14:56:38 -0700 Subject: [PATCH 2/3] regression test --- tests/docs/smoke-all/2024/12/17/issue-11699.qmd | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/docs/smoke-all/2024/12/17/issue-11699.qmd 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" +--- + + From 19d5554e3df93e6edbb56f94dacecc9dd36e6316 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Tue, 17 Dec 2024 14:57:28 -0700 Subject: [PATCH 3/3] changelog --- news/changelog-1.7.md | 1 + 1 file changed, 1 insertion(+) diff --git a/news/changelog-1.7.md b/news/changelog-1.7.md index 569fb2da01..5e836b152d 100644 --- a/news/changelog-1.7.md +++ b/news/changelog-1.7.md @@ -26,6 +26,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. ## Other Fixes and Improvements