feat(wrap): interpolate any --meta-json key (generic frontmatter hook) - #127
Merged
Merged
Conversation
rotkeeper #269 asks for reusable Oliver hooks: injecting a new frontmatter field should not require a struct field, fieldVal entry, rebuild, and pin move each time. wrap now parses the meta JSON twice — the typed v1/v2 struct (unchanged semantics) plus a dynamic object map — and any key present in the map becomes an interpolatable token: - string values substitute html-escaped, like every metadata token - null → empty (and $if$ gates off) - integers/floats/booleans stringify - objects/arrays render as compact JSON (escaped on substitution) - $if(name)$ gating extends to every present key - keys absent from meta-json still pass through verbatim The typed fieldVal lookup stays first, so the 13 known tokens keep their exact behavior; extras are purely additive. 466 tests green, including new v3 coverage for substitution, escaping, stringification, gating, null gating, and verbatim passthrough. Generated with Codebuff 🤖 Co-Authored-By: Codebuff <noreply@codebuff.com>
|
SummaryCoverage spans normal template rendering, conditional content inclusion and removal, metadata substitution and HTML escaping, preservation of trusted and unknown values, typed-value precedence, and malformed or invalid metadata handling. It also exercises ordering and edge-case behavior where conditional markers or metadata are absent, null, nested-looking, or conflicting. Safe to merge — all exercised behaviors passed, including normal flows, security-relevant escaping, validation failures, and edge cases, with no PR-attributable regressions or unresolved failures. There are no merge blockers identified in this run. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Generic frontmatter hook for
oliver wraprotkeeper issue #269 asks for reusable Oliver hooks: injecting a new frontmatter field should not require a struct field,
fieldValentry, rebuild, and pin move every time. This PR makes thewrapdialect generic.What changes
wrapnow parses--meta-jsontwice — the typed v1/v2 struct (unchanged semantics) plus a dynamic object map — and any key present in the map becomes an interpolatable token:null→ empty (and$if$gates off)$count$with"count": 7→7)$if(name)$gating extends to every present keyThe typed
fieldVallookup runs first, so the 13 known tokens keep their exact behavior; extras are purely additive. This is the "reusable hooks" ask from rotkeeper #269 — no upstream change needed to add a frontmatter field, the adapter just merges it into meta-json.Tests
466 tests green, including new v3 coverage: generic substitution, html-escaped extras, scalar stringification (int/bool/object),
$if$gating on generic keys, null-gating, and verbatim passthrough for absent keys.