From 4c12da7ac0324afc66a8997d0c06ee1b2fcc6038 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Mon, 30 Sep 2024 13:25:10 -0700 Subject: [PATCH 1/2] shortcodes -- allow '\\.' in shortcode key resolution --- src/resources/filters/quarto-pre/options.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/resources/filters/quarto-pre/options.lua b/src/resources/filters/quarto-pre/options.lua index 79e6c87211..5689146743 100644 --- a/src/resources/filters/quarto-pre/options.lua +++ b/src/resources/filters/quarto-pre/options.lua @@ -38,10 +38,13 @@ function var(name, def) end end -function parseOption(name, options, def) +function parseOption(name, options, def) + print(name) + name = name:gsub("%\\%.", string.char(1)) local keys = split(name, ".") local value = nil for i, key in ipairs(keys) do + key = key:gsub(string.char(1), "."):gsub("%\\(.)", "%1") if value == nil then value = readOption(options, key, nil) else From 415aec5563f228ca21e381110b27e3f2367a2ae6 Mon Sep 17 00:00:00 2001 From: Carlos Scheidegger Date: Mon, 30 Sep 2024 13:27:27 -0700 Subject: [PATCH 2/2] changelog --- news/changelog-1.6.md | 1 + tests/docs/smoke-all/2024/09/30/issue-10936.qmd | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/docs/smoke-all/2024/09/30/issue-10936.qmd diff --git a/news/changelog-1.6.md b/news/changelog-1.6.md index e86e7f8801..02bbb05e3f 100644 --- a/news/changelog-1.6.md +++ b/news/changelog-1.6.md @@ -93,3 +93,4 @@ All changes included in 1.6: - ([#10608](https://github.com/quarto-dev/quarto-cli/issues/10608)): Don't overwrite the built-in CSS function `contrast` in Quarto's SCSS. - ([#10821](https://github.com/quarto-dev/quarto-cli/issues/10821)): Be more conservative in stripping `echo: fenced` from fenced output. - ([#10890](https://github.com/quarto-dev/quarto-cli/issues/10890)): Don't use ports that Firefox considers unsafe. +- ([#10936](https://github.com/quarto-dev/quarto-cli/issues/10936)): Use `\\` in `meta` shortcode to escape the following character, allowing keys with `.` in them. diff --git a/tests/docs/smoke-all/2024/09/30/issue-10936.qmd b/tests/docs/smoke-all/2024/09/30/issue-10936.qmd new file mode 100644 index 0000000000..b8d1b328d2 --- /dev/null +++ b/tests/docs/smoke-all/2024/09/30/issue-10936.qmd @@ -0,0 +1,16 @@ +--- +nested: + a.b.c: + key: cb593803d9d65583347959fd848b5536 +_quarto: + tests: + html: + ensureFileRegexMatches: + - ['cb593803d9d65583347959fd848b5536'] +--- + +I would like to show the "Show me" using a shortcode. + +E.g. {{< meta nested.a\\.b\\.c.key >}} + +but it fails. \ No newline at end of file