Conformance Examples 0.1.0 — Render: with-block¶
with-pushes-object-context¶
A {{#with}} block pushes a resolved object onto the context stack.
Template
Context
Output
with-this-renders-pushed-context¶
{{this}} inside a with block renders the pushed context as JSON (unescaped, as it is not a string primitive).
Template
Context
Output
with-dot-shortcut¶
{{ . }} inside a with block renders the pushed context the same as {{this}} (unescaped, as it is not a string primitive).
Template
Context
Output
with-pop-restores-outer-context¶
After a with block ends, the outer context is restored and available to subsequent interpolations.
Template
Context
Output
with-nested¶
With blocks can be nested, each pushing a new context onto the stack.
Template
Context
Output
with-rfc6901-identifier¶
The identifier in a {{#with}} can be an RFC 6901 pointer.
Template
Context
Output
with-dot-notation-identifier¶
The identifier in a {{#with}} can be dot-notation.
Template
Context
Output
with-this-identifier¶
{{#with this}} pushes the root context again, making it available to subsequent identifiers.
Template
Context
Output
with-array-top-rfc6901¶
When the pushed context is a JsonArray, RFC 6901 pointers into it work correctly.
Template
Context
Output
with-array-top-this¶
When the pushed context is a JsonArray, {{this}} renders it as JSON.
Template
Context
Output
with-missing-key-pushes-null-this-renders-null¶
When the identifier resolves to a missing key, null is pushed; {{this}} renders "null".
Template
Context
Output
with-missing-key-then-identifier-is-null¶
When the pushed context is null, any non-this identifier yields null.
Template
Context
Output
with-primitive-then-identifier-is-null¶
When the pushed context is a JsonPrimitive, any non-this identifier yields null.
Template
Context
Output
with-primitive-then-this-renders¶
When the pushed context is a JsonPrimitive, {{this}} renders it as a string.
Template
Context
Output
with-peer-blocks¶
Multiple with blocks at the same level each push and pop correctly, restoring the outer context between them.
Template
Context
Output
with-doubled-adjacent-with-same-key¶
Two adjacent {{#with}} blocks over the same key each push and pop independently; the second is unaffected by the first.
Template
Context
Output
Source fixture: render/with-block.json