Directives have the form $directive{expr}.
What expr may be depends on the directive e.g.
for $if{expr}
the expr
is a normal expression evaluated as a bool
while for
$for{expr in sequence}
it must have this specific form.
A directive clause does not always have an expr,
and in these cases the curly braces are not present,
e.g. $else
, $fi
, $rof
.
Directives must respect their specific context,
e.g. if a $for{}
is opened inside a nested template,
then it must be closed with $rof
within the
same nested template.
Directives, in general, may be liberally intermixed and nested.
A begin/end
block may include other begin/end
blocks, if
blocks, for
blocks,
an overlay
declaration, etc.
However, specific constraints apply,
e.g. only one prefer
and overlay
directives are allowed per template, nested or not, and they must be
declared at top level of the template to which they pertain.
There is no significance to whether directives and any
clauses are specified on a single line or on separate lines.
This has benefits such as allowing an inlined if/else
e.g. to calculate the value of an HTML attribute,
just as easily as multi-line if/else
blocks
to control which section of a template gets rendered.