Expand description
Markup a module adds to every theme engine: functions, filters, tests and globals installed into the environment before the templates compile.
A module implements Markup and registers a MarkupReg; the site and
the static build install every registration when they build an engine, in
registration order.
use laterite_web::theme::markup::{Markup, MarkupReg};
use minijinja::Environment;
use std::sync::Arc;
struct Money;
impl Markup for Money {
fn install(&self, env: &mut Environment<'static>) {
env.add_filter("money", |minor: i64| format!("{}.{:02}", minor / 100, minor % 100));
}
}
registry.add(MarkupReg::new("acme.money", Arc::new(Money)));Structs§
- Markup
Reg - A registered markup extension: a key naming it, and the extension.
Traits§
- Markup
- What a module installs into a theme engine.
Functions§
- install_
all - Installs every registration into
env, in order.