Skip to content

Conformance Examples 0.1.0 — Partials: standalone-indent-rendering

standalone-partial-reindents-every-line-of-a-multiline-partial

A standalone {{> key }} tag with leading indentation re-indents every line of a multi-line partial's rendered output, including interior lines, but does not add trailing indentation after the partial's own final newline.

Template

before
  {{> lines }}
after

Partials

lines:

one
two
three

Output

before
  one
  two
  three
after

nested-standalone-partial-indentation-composes

When a standalone partial's own body contains another standalone partial reference, the inner partial's re-indentation composes with the outer one's, so the innermost content is prefixed by both indentations combined.

Template

{{> outer }}

Partials

outer:

start
  {{> inner }}
end

inner:

a
b

Output

start
  a
  b
end

standalone-partial-with-empty-content-adds-no-indentation

A standalone partial whose rendered content is the empty string contributes no indented line at all; re-indentation is a no-op on empty content even though the captured indent itself is non-empty.

Template

before
  {{> empty }}
after

Partials

empty:


Output

before
after

non-standalone-partial-is-not-reindented

A partial tag that shares its line with other template text is not standalone, so its rendered output is inserted verbatim with no re-indentation of interior lines.

Template

before   {{> lines }}   after

Partials

lines:

one
two

Output

before   one
two
   after

Source fixture: partials/standalone-indent-rendering.json