lavender.software/build_src/main_page.rs

60 lines
1.3 KiB
Rust
Raw Normal View History

2022-03-05 14:41:57 +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 = [
2022-03-05 15:36:14 +00:00
("charlotte som", "https://char.lt/", "founder"),
2022-03-05 14:41:57 +00:00
(
2022-03-05 15:36:14 +00:00
"agatha lovelace",
"https://technogothic.net/",
"vampy wolfy",
2022-03-05 14:41:57 +00:00
),
(
"annie versario",
2022-03-05 15:36:14 +00:00
"https://versary.town",
"marquee technician",
2022-03-05 14:41:57 +00:00
),
2022-03-05 15:36:14 +00:00
("ella paws", "#", ""),
2022-03-05 14:41:57 +00:00
(
2022-03-05 15:36:14 +00:00
"maia arson crimew",
2022-03-09 12:26:25 +00:00
"https://maia.crimew.gay/",
"tiny kitten",
2022-03-05 14:41:57 +00:00
),
2022-03-05 15:36:14 +00:00
("easrng", "https://easrng.net/", ""),
2022-03-07 21:48:07 +00:00
("luna nova", "https://luna.mint.lgbt", "local anime catgirl/ruby enthusiast"),
2022-03-05 14:41:57 +00:00
];
ctx.write(
"index.html",
MainPageTemplate {
members: members.iter().map(|x| x.into()).collect(),
}
.render()?,
)?;
Ok(())
}