Skip to content

TemplateValue

[Source]

A value that can be used in a template. Either a single value or a sequence of values.

When used with HtmlTemplate, values are automatically escaped based on their HTML context. To bypass escaping for trusted content, use the unescaped constructor instead of create.

class box TemplateValue

Constructors

create

[Source]

new box create(
  value: (String val | Seq[TemplateValue box] box),
  properties: HashMap[String val, TemplateValue box, HashEq[String val] val] box = qualify)
: TemplateValue box^

Parameters

Returns


unescaped

[Source]

Create a value that bypasses HTML auto-escaping in HtmlTemplate. The content is inserted as-is, without context-aware escaping. Use this only for content you trust (e.g., pre-sanitized HTML fragments).

Has no effect when used with plain Template, which does not escape.

Note: the unescaped annotation applies only to direct variable substitution ({{ name }}). When a value passes through a filter pipe ({{ name | upper }}), the result is always escaped — filters could introduce unsafe content.

new box unescaped(
  value: (String val | Seq[TemplateValue box] box),
  properties: HashMap[String val, TemplateValue box, HashEq[String val] val] box = qualify)
: TemplateValue box^

Parameters

Returns


Public Functions

apply

[Source]

fun box apply(
  name: String val)
: TemplateValue box ?

Parameters

Returns


string

[Source]

fun box string()
: String val ?

Returns


renderable

[Source]

The rendering strategy for this value. HtmlTemplate calls this to determine how to escape the value based on HTML context.

fun box renderable()
: RenderableValue val

Returns


values

[Source]

fun box values()
: Iterator[TemplateValue box] ref

Returns