- dynamic
- zero-allocation in render
- logic-less
- enables structural sharing
{ if path.to.item } ... { end }
{ for item in path.to.items } ... { end }
{ include template_name }
{ path.to.item }
To escape {
and }
, use {{
and }}
, respectively.
A macro can be used so that you can pass your own structs in as data to your templates.
context! {
self: (TYPE PARAMETERS) TYPE {
key1 => self.value,
key2 => @iter self.iterable,
key3 => @raw self.html,
key4 => @{
key5 => self.another_value,
...
},
...
}
}
You might also want to see the macros example. Note that these "contexts" are composable.
- All undefined values are falsey.
- Objects, maps and arrays are truthy.
- Booleans evaluate to their own value.
- Integers are truthy iff they are non-zero.
- Strings are truthy iff they are non-empty.
- Try to make truthiness as unsurprising as possible.
Features will be added as they are needed. If you think something is missing, please open an issue!