Skip to content

TemplateSink

[Source]

Receives the output of a template walk as a sequence of literal and dynamic segments. Calls strictly alternate between literal and dynamic_value, starting and ending with literal. For N dynamic insertions, exactly N+1 literal calls are made. Empty strings are used where needed to maintain this interleaving invariant.

Control flow subtrees (if, ifnot, for) collapse into a single dynamic_value call containing the fully rendered branch or loop output. block is transparent — its literal content merges into the surrounding literal segments.

interface ref TemplateSink

Public Functions

literal

[Source]

Called with a static template segment. May be an empty string when two dynamic values are adjacent or at template boundaries.

fun ref literal(
  text: String val)
: None val

Parameters

Returns


dynamic_value

[Source]

Called with a resolved (and, for HtmlTemplate, already-escaped) dynamic value. For control flow subtrees, contains the fully rendered branch or loop output as a single string.

fun ref dynamic_value(
  value: String val)
: None val

Parameters

Returns