1
Fork 0
advent-of-code/source/templates/mod.rs

22 lines
518 B
Rust

//! The templating code for [`askama`].
use askama::Template;
use crate::solution::Solution;
/// The HTML template for all solutions.
#[derive(Template)]
#[template(path = "solutions.html")]
pub struct SolutionsTemplate {
/// All solutions grouped by year.
pub years: Vec<Vec<Solution>>,
}
/// Custom [`askama`] filters.
pub mod filters {
/// See [`crate::utilities::random_emoji`].
pub fn random_emoji(s: &str) -> askama::Result<String> {
Ok(format!("{s} {}", crate::utilities::random_emoji()))
}
}