Skip to content

Conformance Examples 0.1.0 — Partials: inline-duplicate-names

duplicate-inline-definition-last-wins-and-reports

Two {{#inline g }} blocks defining the same name in the same enclosing block resolve to the later ('last-wins') definition, and the fold reports one DuplicateDefinition soft-fail event for the overridden name. The event is stamped at the root, so its partialStack is empty.

Template

{{#inline g }}FIRST{{/inline}}{{#inline g }}SECOND{{/inline}}{{> g }}

Partials

Output

SECOND

duplicate-inline-definition-inside-a-loaded-partial-reports-its-partial-stack

A duplicate name declared inside a loaded partial's own body is folded (and reported) while that partial's body is being rendered, so the event's partialStack names the enclosing partial.

Template

{{> outer }}

Partials

outer:

{{#inline g }}A{{/inline}}{{#inline g }}B{{/inline}}{{> g }}

Output

B

duplicate-inline-definition-inside-each-reports-once-per-iteration

The pre-scan/fold that detects a duplicate name runs once per render occurrence of the enclosing block, so a duplicate inside a {{#each}} body reports one DuplicateDefinition event per loop iteration, not once overall.

Template

{{#each items }}{{#inline g }}A{{/inline}}{{#inline g }}B{{/inline}}{{> g }}{{/each}}

Context

{
    "items": [
        1,
        2
    ]
}

Partials

Output

BB

Source fixture: partials/inline-duplicate-names.json