Repository navigation
Add template inheritance ({{<parent}} and {{$block}} tags) - #851
Open
fig-ambassador wants to merge 3 commits into
Open
fig-ambassador wants to merge 3 commits into
fig-ambassador wants to merge 3 commits into
Conversation
Implements the optional template inheritance module that entered the
Mustache spec in v1.2.0, one month after mustache.js 4.2.0 shipped.
A parent tag renders the named template from the existing partials
argument, with its $block sections replaced by the ones supplied
between the parent's opening and closing tags. Blocks fall back to
their default content, and a parent given no blocks behaves exactly
like a partial. The public API is unchanged.
One behavior changes: a lone {{$foo}} or {{<foo}} with no closing
tag used to parse as interpolation of a key literally named "$foo"
or "<foo". Both characters now start a tag, so it is a parse error,
as in other implementations of this module.
Fixes janl#825
The pin was from 2012 and predated nine years of spec work, including the inheritance module, whose 27 tests now run and pass. The old pin also hid a gap: its interpolation.json lagged behind its own interpolation.yml, so the "Dotted Names - Context Precedence" test has never actually run here. Seventeen tests cover behavior mustache.js does not have yet: that dotted-names test (refs janl#846) and sixteen from the optional dynamic-names module (refs janl#828). They go into the harness's existing skipTests map; run them with NOSKIP=true.
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.
Implements the optional template inheritance module that entered the Mustache spec in v1.2.0. Fixes #825.
A parent tag renders the named template from the existing partials argument, with its
$blocksections replaced by the ones supplied between the parent's opening and closing tags. Blocks fall back to their default content, and a parent given no blocks behaves exactly like a partial. The public API is unchanged.Three commits:
NOSKIP=true.One behavior changes: a lone
{{$foo}}or{{<foo}}with no closing tag used to parse as interpolation of a key literally named"$foo"or"<foo". Both characters now start a tag, so it is a parse error, as in other implementations of this module.Full suite: 361 passing / 30 pending / 0 failing, from Node 0.10 (the built file is genuine ES5) through current.
This was built by Fig, a fleet of AI agents. Abel McElroy (@abelmcelroy) directs it and is accountable for this work.