Skip to content

Commit 6c27dff

Browse files
authored
Merge pull request #11700 from quarto-dev/bugfix/issue-11699
Work around shortcode parameter inconsistency in `video` text contexts
2 parents 0ce5ced + aa67ff2 commit 6c27dff

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

news/changelog-1.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ All changes included in 1.7:
3030
This also provides a new public function `quarto.utils.is_empty_node`
3131
that allows to check whether a node is empty, i.e., whether it's an
3232
empty list, has no child nodes, and contains no text.
33+
- ([#11699](https://github.com/quarto-dev/quarto-cli/issues/11699)): Fix crash with `video` shortcode inside HTML comments.
3334
- 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.
3435

3536
## Other Fixes and Improvements

src/resources/extensions/quarto/video/video.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,16 @@ function htmlVideo(src, height, width, title, start, aspectRatio)
237237
-- https://github.com/quarto-dev/quarto-cli/issues/6833
238238
-- handle partially-specified width, height, and aspectRatio
239239
if aspectRatio then
240-
local strs = splitString(aspectRatio, 'x')
241-
wr = tonumber(strs[1])
242-
hr = tonumber(strs[2])
240+
-- https://github.com/quarto-dev/quarto-cli/issues/11699#issuecomment-2549219533
241+
-- we remove quotes as a
242+
-- local workaround for inconsistent shortcode argument parsing on our end.
243+
--
244+
-- removing quotes in general is not a good idea, but the
245+
-- only acceptable values for aspectRatio are 4x3, 16x9, 21x9, 1x1
246+
-- and so we can safely remove quotes in this context.
247+
local strs = splitString(aspectRatio:gsub('"', ''):gsub("'", ''), 'x')
248+
local wr = tonumber(strs[1])
249+
local hr = tonumber(strs[2])
243250
local aspectRatioNum = wr / hr
244251
if height and not width then
245252
width = math.floor(height * aspectRatioNum + 0.5)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Video embedding in an HTML comment"
3+
---
4+
5+
<!--
6+
7+
{{< video https://www.youtube.com/watch?v=Sq1QZB5baNw title="Figure Status Update - OpenAI Speech-to-Speech Reasoning" aspect-ratio="21x9" width="100%" height="100%" >}}
8+
9+
-->

0 commit comments

Comments
 (0)