Repository navigation
🐛 fix(parser): recognise {{&name}} ampersand tags as blanks - #333
Conversation
Closes #332 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Read this against the tree at 1e7fbbe, not just the diff. Looks correct to me.
What I verified:
src/parser.ts:34,40— the optional(?:&\s*)?group sits before the name capture in bothVAR_PATTERNandDOTTED_PATTERN, so{{&name}},{{& name }}and{{&name=dflt}}produce the sameTemplateVaras the bare forms, and{{&a.b}}hits the existing dotted rejection atsrc/parser.ts:47-52. Sigil tags ({{#x}},{{!c}}) still don't match because&is the only sigil admitted.src/parser.ts:92-94—expand()keeps the&when normalizing, so Mustache still sees a variable tag; with escaping disabled per-call the output is identical to{{name}}. An unfilled{{&name}}is preserved as{{name}}(drops the&) — the test atsrc/parser.test.ts:169asserts that explicitly, so it's intended.- Every consumer named in #332 goes through the shared pattern:
src/commands.ts:124(showhighlighting) andsrc/ui.html:663,821-822(builder table and preview) importVAR_PATTERN/parseVarsfrom./parser.js, so no second regex copy was missed. - Ran the built CLI:
"A: {{&word}} B: {{& word }} C: {{&other=dft}}" --word=hi→A: hi B: hi C: dft;{{&a.b}}→Unsupported variable name "a.b". - On the body's caveat ("dist/ was hand-synced … source maps not regenerated"): I ran
npm ci && npm run buildon this head andgit status --porcelain -- dist/is empty, sodist/— maps included — matches whattscemits. The CI dist-sync gate agrees (all sixbuild-and-testlegs green).
No findings from me; the remaining tide check is the only thing pending.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #332
VAR_PATTERN and DOTTED_PATTERN now accept an optional
&sigil, so{{&name}},{{& name }}and{{&name=default}}are the same blank as{{name}}(as the UI cheatsheet promises). expand() keeps the&when normalizing. Dotted{{&a.b}}is rejected like{{a.b}}. Tests and changelog fragment added.dist/ was hand-synced (parser.js, parser.test.js, cli.test.js) without running tsc; source maps not regenerated.
Validation: not run locally per hive policy; CI is the verdict.
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88