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
//! `TemplateEngine` port — the seam between the pure site-build use case
//! and a concrete templating implementation (Tera, in-process today).
//!
//! Domain code constructs a [`TemplateContext`] from any
//! `serde::Serialize` shape, then asks the engine to render a named
//! template against it. The trait is intentionally narrow: template
//! lookup conventions (e.g. `<kind>/single.html` → `_default/single.html`)
//! live in the caller, not in the engine.
use Serialize;
/// Generic, serde-compatible bag of values fed to the template engine.
///
/// We intentionally use `serde_json::Value` as the carrier rather than a
/// bespoke enum so the domain stays free of any templating-engine type
/// while still being able to express arbitrary nested structures (lists of
/// records, optional fields, link maps, …).
;
/// Render a named template with a context, returning HTML.
///
/// Errors must surface enough information for the caller to point the user
/// at the offending template — typically the template name plus the parse
/// or rendering message.