//! Askama templates for the public embed widgets (`/embed/*`). Ported from //! hand-rolled `format!` HTML so user-derived fields (titles, creator names, //! descriptions, URLs) are autoescaped by Askama rather than per-field by hand. use askama::Template; #[derive(Template)] #[template(path = "embed/item_button.html")] pub struct EmbedItemButtonTemplate { pub title: String, pub price_display: String, pub purchase_url: String, pub button_text: String, pub cover_image_url: Option, } #[derive(Template)] #[template(path = "embed/item_card.html")] pub struct EmbedItemCardTemplate { pub title: String, pub price_display: String, pub purchase_url: String, pub button_text: String, pub cover_image_url: Option, pub creator_display_name: String, pub profile_url: String, /// Empty string = no description block. pub description_excerpt: String, pub is_horizontal: bool, } #[derive(Template)] #[template(path = "embed/item_player.html")] pub struct EmbedItemPlayerTemplate { pub title: String, pub price_display: String, pub purchase_url: String, pub button_text: String, pub creator_display_name: String, pub cover_image_url: Option, pub preview_url: String, } #[derive(Template)] #[template(path = "embed/tip_button.html")] pub struct EmbedTipButtonTemplate { pub display_name: String, pub username: String, pub tip_url: String, pub avatar_url: Option, } #[derive(Template)] #[template(path = "embed/project_card.html")] pub struct EmbedProjectCardTemplate { pub title: String, pub creator_display_name: String, pub profile_url: String, pub project_url: String, pub cover_image_url: Option, /// Empty string = no description block. pub description_excerpt: String, pub item_count: usize, pub category_label: String, }