Skip to content

Conformance Examples 0.1.0 — Render: interpolation-rendering

string-primitive-unquoted

{{ /name }} emits the string value without surrounding JSON quotes.

Template

Hello {{ /name }}!

Context

{
    "name": "Alice"
}

Output

Hello Alice!

integer-primitive

Integer primitives render as their JSON form (no quotes).

Template

Age: {{ /age }}

Context

{
    "age": 30
}

Output

Age: 30

decimal-primitive

Decimal numbers render with their JSON form.

Template

Pi ~= {{ /pi }}

Context

{
    "pi": 3.14159
}

Output

Pi ~= 3.14159

boolean-true

true renders as the literal token "true".

Template

Active: {{ /active }}

Context

{
    "active": true
}

Output

Active: true

boolean-false

false renders as the literal token "false".

Template

Active: {{ /active }}

Context

{
    "active": false
}

Output

Active: false

json-null-renders-null

An explicit JSON null renders as the literal token "null".

Template

Value: {{ /value }}

Context

{
    "value": null
}

Output

Value: null

missing-key-renders-null

A pointer that resolves to no element renders as the literal token "null".

Template

Value: {{ /value }}

Context

{}

Output

Value: null

nested-pointer

JSON Pointer normal notation reaches into nested objects.

Template

City: {{ /user/address/city }}

Context

{
    "user": {
        "address": {
            "city": "Springfield"
        }
    }
}

Output

City: Springfield

array-index

JSON Pointer can index arrays.

Template

Second: {{ /names/1 }}

Context

{
    "names": [
        "Alice",
        "Bob",
        "Carol"
    ]
}

Output

Second: Bob

object-renders-as-json

A non-leaf JSON object renders as its compact JSON form (unescaped, as it is not a string primitive). Template-author bug, but defined behaviour.

Template

Obj: {{ /user }}

Context

{
    "user": {
        "name": "Alice"
    }
}

Output

Obj: {"name":"Alice"}

array-renders-as-json

A non-leaf JSON array renders as its compact JSON form (unescaped, as it is not a string primitive).

Template

Arr: {{ /names }}

Context

{
    "names": [
        "a",
        "b"
    ]
}

Output

Arr: ["a","b"]

unescaped-string-primitive

{{{ /name }}} emits the string value without HTML escaping; unlike {{ /name }}, HTML-special characters are not escaped.

Template

Hello {{{ /name }}}!

Context

{
    "name": "Alice"
}

Output

Hello Alice!

trim-variant-still-renders

Trim-delimiter variants with a plain value resolve the same way as non-trim variants when the value has no surrounding whitespace.

Template

X{{~ /name ~}}Y

Context

{
    "name": "Alice"
}

Output

XAliceY

string-with-quote-content-only

Embedded characters in a string primitive emit verbatim (no JSON escaping).

Template

{{ /s }}

Context

{
    "s": "a \"quoted\" word"
}

Output

a "quoted" word

single-slash-pointer-is-empty-key

/ parses to a JsonPointer with one empty segment — i.e. the key whose name is the empty string.

Template

X={{ / }}

Context

{
    "": "empty-key-value"
}

Output

X=empty-key-value

rfc6901-escape-slash

RFC 6901: ~1 inside a segment decodes to / — addresses the key a/b.

Template

{{ /a~1b }}

Context

{
    "a/b": "found"
}

Output

found

rfc6901-escape-tilde

RFC 6901: ~0 inside a segment decodes to ~ — addresses the key a~b.

Template

{{ /a~0b }}

Context

{
    "a~b": "found"
}

Output

found

rfc6901-escape-tilde-then-one-is-literal-tilde-one

RFC 6901 ordering: ~01 decodes as ~1 literally (tilde-substitution is applied last, not recursively).

Template

{{ /a~01b }}

Context

{
    "a~1b": "found"
}

Output

found

rfc6901-escape-only-tilde-key

A segment of just ~0 decodes to the bare key ~.

Template

{{ /~0 }}

Context

{
    "~": "tilde-value"
}

Output

tilde-value

rfc6901-escape-only-slash-key

A segment of just ~1 decodes to the bare key /.

Template

{{ /~1 }}

Context

{
    "/": "slash-value"
}

Output

slash-value

Source fixture: render/interpolation-rendering.json