8 releases (4 breaking)
Uses old Rust 2015
0.5.1 | Nov 18, 2017 |
---|---|
0.5.0 | Nov 17, 2017 |
0.4.2 | Nov 16, 2017 |
0.3.0 | Nov 12, 2017 |
0.1.0 | Nov 7, 2017 |
#435 in Template engine
31 downloads per month
Used in leven
42KB
1K
SLoC
tenjin
Buzzwords
- dynamic
- zero-allocation in render
- logic-less
- enables structural sharing
Template Syntax
{ if path.to.item } ... { end }
{ for item in path.to.items } ... { end }
{ include template_name }
{ path.to.item }
To escape {
and }
, use {{
and }}
, respectively.
Macro Syntax
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.
Truthiness
- 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.
Contributing
Features will be added as they are needed. If you think something is missing, please open an issue!
Dependencies
~0.5–1MB
~20K SLoC