Skip to content

Template

[Source]

class val Template

Constructors

parse

[Source]

new val parse(
  source: String val,
  ctx: TemplateContext val = call)
: Template val^ ?

Parameters

Returns


from_file

[Source]

new val from_file(
  path: FilePath val,
  ctx: TemplateContext val = call)
: Template val^ ?

Parameters

Returns


Public Functions

render

[Source]

Render the template with the given values and return the result as a single string.

fun box render(
  values: TemplateValues box)
: String val ?

Parameters

Returns


render_to

[Source]

Walk the template and drive the given sink with alternating literal and dynamic_value calls. Values are not escaped — they pass through as-is. See TemplateSink for the interleaving guarantee.

fun box render_to(
  sink: TemplateSink ref,
  values: TemplateValues box)
: None val ?

Parameters

Returns


render_split

[Source]

Render the template and return the static literal segments and dynamic value segments as separate arrays. For N dynamic insertions, the statics array has N+1 entries. Concatenating statics(0) + dynamics(0) + statics(1) + dynamics(1) + ... + statics(N) produces the same result as render().

fun box render_split(
  values: TemplateValues box)
: (Array[String val] val , Array[String val] val) ?

Parameters

Returns