Skip to content

Commit 97c5662

Browse files
committed
Fix meta shortcode truncating multi-word values in raw HTML contexts
1 parent b121643 commit 97c5662

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

src/resources/filters/quarto-pre/shortcodes-handlers.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ function handleMeta(args, _kwargs, _meta, _raw_args, context)
267267
--
268268
-- differently to allow users to specify precisely the
269269
-- string they want to use.
270-
if type(optionValue) == "table" and #optionValue > 0 and optionValue[1].t == "Str" then
270+
if type(optionValue) == "table" and #optionValue == 1 and optionValue[1].t == "Str" then
271271
return optionValue[1].text
272+
elseif pandoc.utils.type(optionValue) == "Inlines" then
273+
return pandoc.utils.stringify(optionValue)
272274
else
273275
local blocks = pandoc.Blocks(optionValue)
274276
return pandoc.write(pandoc.Pandoc(blocks), "markdown")
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
format: html
3+
my-value: Release Candidate
4+
include-after-body:
5+
text: |
6+
<script>window["test-include"] = '{{< meta my-value >}}';</script>
7+
_quarto:
8+
tests:
9+
html:
10+
ensureFileRegexMatches:
11+
-
12+
- "test-include.*Release Candidate"
13+
- "test-rawblock.*Release Candidate"
14+
---
15+
16+
Inline: {{< meta my-value >}}
17+
18+
```{=html}
19+
<script>window["test-rawblock"] = '{{< meta my-value >}}';</script>
20+
```

0 commit comments

Comments
 (0)