lavender.software/build_src/main_page.rs

59 lines
1.4 KiB
Rust
Raw Normal View History

2021-07-12 20:47:49 +00:00
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"),
2021-07-13 02:29:35 +00:00
("maya", "https://1312.gay/", "chief director of maya"),
2021-07-13 02:34:20 +00:00
(
"Luna Lulu",
"https://lunaisa.dev",
2021-07-13 22:04:14 +00:00
"critically acclaimed website maker",
),
(
"annie versario",
"https://annie.kitty.lgbt",
"regional marquee technician",
2021-07-13 02:34:20 +00:00
),
(
"The System",
"https://the-system.eu.org",
"lead systems specialist",
),
2021-07-12 20:47:49 +00:00
];
ctx.write(
"index.html",
MainPageTemplate {
members: members.iter().map(|x| x.into()).collect(),
}
.render()?,
)?;
Ok(())
}