forked from lavender-legacy/lavender.software
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
use crate::*;
|
|
|
|
struct Member {
|
|
name: String,
|
|
website: String,
|
|
title: String,
|
|
}
|
|
|
|
impl From<&(&str, &str, &str)> for Member {
|
|
fn from(tuple: &(&str, &str, &str)) -> Self {
|
|
Member {
|
|
name: tuple.0.to_string(),
|
|
website: tuple.1.to_string(),
|
|
title: tuple.2.to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "main_page.html.j2")]
|
|
struct MainPageTemplate {
|
|
members: Vec<Member>,
|
|
}
|
|
|
|
pub fn main_page(ctx: &BuildContext) -> Result<()> {
|
|
log_info("Rendering main page…");
|
|
|
|
let members = [
|
|
("charlotte som", "https://som.codes/", "founder"),
|
|
("agatha rose", "https://agatharose.dev/", "meow"),
|
|
("maya", "https://1312.gay/", "chief director of maya"),
|
|
("Luna Lulu", "https://lunaisa.dev", "resident capitalist (haha because her name is capitalised)")
|
|
];
|
|
|
|
ctx.write(
|
|
"index.html",
|
|
MainPageTemplate {
|
|
members: members.iter().map(|x| x.into()).collect(),
|
|
}
|
|
.render()?,
|
|
)?;
|
|
|
|
Ok(())
|
|
}
|