TemplateValue¶
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.
Constructors¶
create¶
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¶
- value: (String val | Seq[TemplateValue box] box)
- properties: HashMap[String val, TemplateValue box, HashEq[String val] val] box = qualify
Returns¶
- TemplateValue box^
unescaped¶
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¶
- value: (String val | Seq[TemplateValue box] box)
- properties: HashMap[String val, TemplateValue box, HashEq[String val] val] box = qualify
Returns¶
- TemplateValue box^
Public Functions¶
apply¶
Parameters¶
- name: String val
Returns¶
- TemplateValue box ?
string¶
Returns¶
- String val ?
renderable¶
The rendering strategy for this value. HtmlTemplate calls this to
determine how to escape the value based on HTML context.
Returns¶
- RenderableValue val
values¶
Returns¶
- Iterator[TemplateValue box] ref