Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-template/README.md
damocles 8ef3138863 templates: one Jinja language (hive-template) for the notify router's flows, flows document version 2
A todo node's key and text were hand-expanded `{field}` strings. They are now Jinja templates rendered through the new hive-template crate (minijinja, an unknown variable is an error), and the controller's save check reads the variables the template uses. The flows document is version 2; a version 1 document reads as version 2 with each `{field}` converted to `{{ field }}`, and the next save writes it.
2026-11-11 03:40:22 +01:00

14 lines
695 B
Markdown

# hive-template
The one template language the hyperhive workspace renders with: Jinja, through
[`minijinja`](https://crates.io/crates/minijinja). A value is `{{ name }}`, a
block is `{% if cond %}...{% endif %}`, and a lone `{` or `}` stays plain text.
- **`render(template, &context)`**: the text, or a message when the template
does not parse or names a variable the context lacks. An unknown variable is
an error, never an empty string.
- **`variables(template)`**: the variables the template reads, so a caller can
refuse an unknown field when the template is saved instead of when it renders.
Used by the notification router's flow templates (`swarm-notify-router`,
`swarm-wire`).