summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 77f4fef226c05fb66954645b104253c68a77d6a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use anyhow::Result;
use tera::{Context, Tera};

use crate::works::Works;

mod works;

fn main() -> Result<()> {
    let tera = Tera::new("templates/**/*.html")?;

    let context = Context::new();

    let output = tera.render("index.html", &context)?;

    std::fs::write("docs/index.html", output)?;

    let stories = works::stories::Stories::new_from_file(std::fs::File::open(
        std::path::PathBuf::from("stories.json"),
    )?);
    stories?.render_overview_page(&tera, "stories")?;
    Ok(())
}