Skip to content

Commit 09539d1

Browse files
authored
Fix meta shortcode truncating multi-word values in raw HTML contexts (#14160)
* Fix meta shortcode truncating multi-word values in raw HTML contexts * Update rules for changelog regression policy and regex match format
1 parent 20cb9d2 commit 09539d1

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

.claude/rules/changelog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ For external contributors (not core team):
6565

6666
## Regression Fixes
6767

68-
**What qualifies:** Bugs introduced in recent versions (same major.minor)
68+
**What qualifies:** Bugs introduced in a previous major.minor version (e.g., a 1.8 feature that broke in 1.9)
69+
70+
**Skip changelog entirely** when the regression was introduced by another change in the same version cycle. For example, if a 1.9 bug fix introduced a new bug also fixed in 1.9, the fix does not need a changelog entry — the original entry covers the feature area.
6971

7072
**Placement:** Always at TOP of the file, before Dependencies
7173

.claude/rules/testing/smoke-all-tests.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ _quarto:
6363
- ['\\begin\{figure\}']
6464
```
6565
66+
### Regex Match Array Format
67+
68+
`ensureFileRegexMatches` (and variants like `ensureTypstFileRegexMatches`, `ensureLatexFileRegexMatches`) takes two arrays:
69+
70+
```yaml
71+
ensureFileRegexMatches:
72+
- # First array: patterns that MUST match
73+
- "pattern1"
74+
- "pattern2"
75+
- # Second array (optional): patterns that must NOT match
76+
- "forbidden-pattern"
77+
```
78+
79+
Both patterns in the first array must be found. Any pattern in the second array causes failure if found.
80+
6681
### Message Verification
6782

6883
Lua `warn()` appears as `level: INFO` on TypeScript side:

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)