From 346e40729f8811e25f1fa061f3723f5277794dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 29 Jan 2025 15:27:31 +0100 Subject: [PATCH 1/5] fix: `lipsum` shortcode should have the ability to not randomize Fixes #11664 --- src/resources/extensions/quarto/lipsum/lipsum.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/quarto/lipsum/lipsum.lua b/src/resources/extensions/quarto/lipsum/lipsum.lua index 57e53e820b4..d1f359f76e2 100644 --- a/src/resources/extensions/quarto/lipsum/lipsum.lua +++ b/src/resources/extensions/quarto/lipsum/lipsum.lua @@ -36,6 +36,14 @@ local barePattern = '^(%d+)$' return { ['lipsum'] = function(args, kwargs, meta) + local isRandom = false + if kwargs and kwargs["random"] then + local randomVal = pandoc.utils.stringify(kwargs["random"]) + if randomVal == "true" then + isRandom = true + end + end + local paraStart = 1 local paraEnd = 5 @@ -58,7 +66,9 @@ return { -- a number of paragraphs is specified, like 10 local _,_,bareVal = range:find(barePattern) if bareVal then - paraStart = math.random(1, 17) + if isRandom then + paraStart = math.random(1, 17) + end local endNumber = tonumber(bareVal) if endNumber ~= nil then paraEnd = paraStart + endNumber - 1 From cefd560947b276d685752cadea16c7687ab5e75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 29 Jan 2025 15:32:58 +0100 Subject: [PATCH 2/5] test: add lipsum non randomness --- tests/docs/smoke-all/2025/01/29/issue-11664.qmd | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/docs/smoke-all/2025/01/29/issue-11664.qmd diff --git a/tests/docs/smoke-all/2025/01/29/issue-11664.qmd b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd new file mode 100644 index 00000000000..f1f4736ba09 --- /dev/null +++ b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd @@ -0,0 +1,11 @@ +--- +format: html +_quarto: + tests: + html: + ensurePdfRegexMatches: + - ["1 Section"] + - ["0.1 Section"] +--- + +{{< lipsum 2 >}} From 5bbcd598cbaa762fe3700615164037371a29cd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:02:35 +0100 Subject: [PATCH 3/5] fix: save and commit the regex ... --- tests/docs/smoke-all/2025/01/29/issue-11664.qmd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/docs/smoke-all/2025/01/29/issue-11664.qmd b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd index f1f4736ba09..6fce6973a87 100644 --- a/tests/docs/smoke-all/2025/01/29/issue-11664.qmd +++ b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd @@ -4,8 +4,7 @@ _quarto: tests: html: ensurePdfRegexMatches: - - ["1 Section"] - - ["0.1 Section"] + - ["Nunc ac dignissim magna. Vestibulum vitae egestas elit."] --- {{< lipsum 2 >}} From d1759f47f6e4d2d2f23e474036566136ffce799f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Wed, 29 Jan 2025 16:03:45 +0100 Subject: [PATCH 4/5] fix: use proper "regex" option --- tests/docs/smoke-all/2025/01/29/issue-11664.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/docs/smoke-all/2025/01/29/issue-11664.qmd b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd index 6fce6973a87..b82ed3feabd 100644 --- a/tests/docs/smoke-all/2025/01/29/issue-11664.qmd +++ b/tests/docs/smoke-all/2025/01/29/issue-11664.qmd @@ -3,7 +3,7 @@ format: html _quarto: tests: html: - ensurePdfRegexMatches: + ensureFileRegexMatches: - ["Nunc ac dignissim magna. Vestibulum vitae egestas elit."] --- From f0fc2309b0e265a47082dab8ea133b07802a9f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Canouil?= <8896044+mcanouil@users.noreply.github.com> Date: Fri, 31 Jan 2025 20:01:34 +0100 Subject: [PATCH 5/5] chore: add entry to 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 c42502d7b4f..cf8fc052a7f 100644 --- a/news/changelog-1.7.md +++ b/news/changelog-1.7.md @@ -55,6 +55,7 @@ All changes included in 1.7: - ([#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. - Fix `pandoc.mediabag` Lua typings so autocompletions work with the Lua LSP integration. +- ([#11664](https://github.com/quarto-dev/quarto-cli/issues/11664)): `lipsum` shortcode is no longer randomly generated by default, use `{{< lipsum random=true >}}` to restore randomness. ## Engines