1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! 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.
//!
//! ```no_run
//! 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));
//! }
//! }
//!
//! # fn register(registry: &mut laterite_core::Registry) {
//! registry.add(MarkupReg::new("acme.money", Arc::new(Money)));
//! # }
//! ```
use Environment;
use Arc;
/// What a module installs into a theme engine.
/// A registered markup extension: a key naming it, and the extension.
/// Installs every registration into `env`, in order.