Skip to content

Meta shortcode truncates multi-word values in raw HTML contexts #14159

@cderv

Description

@cderv

{{< meta key >}} drops everything after the first space when the value appears in raw HTML contexts (include-after-body text blocks, raw HTML blocks). Inline paragraph usage works correctly. This is a regression introduced by #14073.

Repro

_quarto.yml:

project:
  type: website
my-value: Release Candidate

index.qmd:

---
format: html
include-after-body:
  text: |
    <script>window["test-include"] = '{{< meta my-value >}}';</script>
---

Inline: {{< meta my-value >}}

```{=html}
<script>window["test-rawblock"] = '{{< meta my-value >}}';</script>
```

Output:

Inline: Release Candidate           ← correct
window["test-rawblock"] = 'Release' ← truncated
window["test-include"] = 'Release'  ← truncated

Root Cause

#14073 (commit f6ecb11) added a text context branch to handleMeta() at src/resources/filters/quarto-pre/shortcodes-handlers.lua:270:

if type(optionValue) == "table" and #optionValue > 0 and optionValue[1].t == "Str" then
  return optionValue[1].text

For "Release Candidate" = [Str("Release"), Space, Str("Candidate")], only optionValue[1].text ("Release") is returned. The condition #optionValue > 0 matches all multi-word strings, but was intended only for single-node pandoc-native values.

Version

Works in v1.9.23, broken since v1.9.24 (first release containing f6ecb11).

Real-world Impact

quarto.org download buttons show "1.9.29 Release" instead of "1.9.29 Release Candidate" because prerelease-mode is set via include-after-body text block.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingshortcodesissues related to shortcodes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions