Skip to content

Conformance Examples 0.1.0 — Partials: inline-standalone-and-trim

standalone-inline-block-tags-strip-like-with-block

An {{#inline}}/{{/inline}} open/close tag alone on its own line (only surrounding whitespace) has that line's leading indentation and trailing newline stripped implicitly, with no ~ marker, exactly like a standalone #with block. The definition itself still renders nothing; the stripped body is what a later invocation renders.

Template

before
  {{#inline greeting }}
  Hi
  {{/inline}}
after{{> greeting }}

Partials

Output

before
after  Hi

standalone-invocation-of-an-inline-partial-reindents-every-line

A standalone {{> key }} invocation re-indents every line of a multi-line inline-partial body, the same as it does for a loaded partial, since both share the same renderPartialBody path.

Template

{{#inline lines }}one
two
three
{{/inline}}before
  {{> lines }}
after

Partials

Output

before
  one
  two
  three
after

tilde-trim-on-inline-block-tags-strips-surrounding-and-inner-whitespace

~ on an {{#inline}}/{{/inline}} tag pair strips whitespace from the surrounding template text (outside the block) and from the body's own leading/trailing text (inside the block), exactly like the equivalent {{#with}} trim behavior.

Template

before  {{~#inline greeting ~}}  Hi  {{~/inline~}}  after{{> greeting }}

Partials

Output

beforeafterHi

Source fixture: partials/inline-standalone-and-trim.json