Crate fluskama

Source
Expand description

§fluskama

an askama wrapper for the fluffer gemini server framework. it eases serving gemini pages written in askama by creating a wrapper for askama’s template type.

§wrapping a template

as previously mentioned, fluskama works as a wrapper for any askama templates. in order to wrap a template, we can call FluffTemplate::from()

use fluskama::FluffTemplate;
use askama::Template;

#[derive(Template)]
#[template(path = "page.gmi", escape = "txt")]
struct Page {
    name: String,
    age: u8,
}

async fn page() -> FluffTemplate<Page> {
    let template = Page {
        name: String::from("John Doe"),
        age: 21
    };

    FluffTemplate::from(template)
}

Structs§

FluffTemplate
Wrapper for any type implementing askama::Template, which adds fluffer::GemBytes as a trait. It can be used as a companion to write gemtext templates, which can later be served using fluffer. It is advised to use a “txt” escaper within the source template.