Module ructe::Template_syntax [−][src]
This module describes the template syntax used by ructe.
The syntax is inspired by Twirl, the Scala-based template engine in Play framework, but of course with rust types expressions instead of scala.
A template consists of three basic parts:
First a preamble of use
statements, each prepended by an @ sign.
Secondly a declaration of the parameters the template takes.
And third, the template body.
@use any::rust::Type;
@(name: &str, items: &[Type])
<html>
...
</html>
The curly brackets, {
and }
, is used for blocks (see Loops,
Conditionals, and Calling other templates below).
To use them in the template body, they must be escaped as @{
and
@}
.
Modules
a_Value_expressions |
A value expression can be as simple as |
b_Loops |
A ructe |
c_Conditionals |
Both |
d_Calling_other_templates |
The ability to call other templates for from a template makes both "tag libraries" and "base templates" possible with the same syntax. |