TemplateSink¶
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.
Public Functions¶
literal¶
Called with a static template segment. May be an empty string when two dynamic values are adjacent or at template boundaries.
Parameters¶
- text: String val
Returns¶
- None val
dynamic_value¶
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.
Parameters¶
- value: String val
Returns¶
- None val