New button template
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

This commit is contained in:
Eric Ratliff
2026-02-22 17:06:02 -06:00
parent 578b5f02c0
commit e12608370a
9 changed files with 898 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ use crate::version::ANVIL_VERSION;
// Embedded template directories
static BASIC_TEMPLATE: Dir = include_dir!("$CARGO_MANIFEST_DIR/templates/basic");
static WEATHER_TEMPLATE: Dir = include_dir!("$CARGO_MANIFEST_DIR/templates/weather");
static BUTTON_TEMPLATE: Dir = include_dir!("$CARGO_MANIFEST_DIR/templates/button");
/// Context variables available in .tmpl files via {{VAR}} substitution.
pub struct TemplateContext {
@@ -106,13 +107,17 @@ fn template_dir(name: &str) -> Option<&'static Dir<'static>> {
match name {
"basic" => Some(&BASIC_TEMPLATE),
"weather" => Some(&WEATHER_TEMPLATE),
"button" => Some(&BUTTON_TEMPLATE),
_ => None,
}
}
// All composed templates (everything except "basic").
fn composed_template_entries() -> Vec<(&'static str, &'static Dir<'static>)> {
vec![("weather", &WEATHER_TEMPLATE)]
vec![
("weather", &WEATHER_TEMPLATE),
("button", &BUTTON_TEMPLATE),
]
}
// =========================================================================