Writs
A writ is an expression wrapped with {{
and }}
that will be evaluated and output into the template.
Hello {{ name }}!
Hello Luna!
But writs support any expression:
{{ a }} + {{ b }} = {{ a + b }}
1 + 2 = 3
No matter how complicated:
{{ (user.name() | upper) ~ " (" ~ (user.company() | lower) ~ ")" }}
CASPER (sloths and stuff, inc.)
Escaping
Eventually you'll likely want to escape user-provided text for safe usage within a markup language. Set a default escaper group and manually specify the escaper anywhere the default escaper for the group won't work:
escaper_groups.html.escaper = "::oxiplate::escapers::HtmlEscaper"
<a href="/{{ attr: user.username }}" title="Visit {{ attr: user.name }}'s profile">
{{ user.name }}
</a>
<a href="/toya_the_sequoia" title="Visit Isabelle "Cat & Mouse" Toya's profile">
Isabelle "Cat & Mouse" Toya
</a>
Read more about escaping in the next chapter.