anvilforge-templates 0.1.0

Forge template runtime for Anvilforge: StackBuffer for @push/@stack, @vite asset helper, escape primitives.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Forge runtime: stack buffer for `@push`/`@stack`, `@vite` asset helper, escape primitives.

pub mod escape;
pub mod stack;
pub mod vite;

pub use askama;
pub use askama::Template;

/// Re-export the common Forge-style template builder.
pub trait View: askama::Template {
    fn render_view(&self) -> Result<String, askama::Error> {
        let raw = self.render()?;
        Ok(stack::postprocess(&raw))
    }
}

impl<T: askama::Template> View for T {}