A lightweight template engine for the SunWeb framework.
You should not depend on this crate directly — use [sunweb] with the
templating feature instead, which re-exports everything from here.
Template Syntax
| Syntax | Description |
|---|---|
{{ name }} |
Inserts a variable from the context |
{% if condition %} ... {% endif %} |
Conditional block |
{% for item in list %} ... {% endfor %} |
Loop over a list |
Example
use ;
let mut ctx = new;
ctx.insert;
ctx.insert;
ctx.insert;
// template: "<h1>{{ title }}</h1>"
// "{% if show_footer %}<footer>bye</footer>{% endif %}"
// "{% for user in users %}<p>{{ user.name }}</p>{% endfor %}"