diff options
author | metamuffin <metamuffin@disroot.org> | 2022-08-29 18:04:17 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-08-29 18:04:17 +0200 |
commit | a4dd9c4944340505962f07853d53ab02f3a02336 (patch) | |
tree | 515b005d52a351ff9d02c86c6de42506557c0559 /code/src | |
parent | da2a95bec7540db923176ae66b8e604011e975e7 (diff) | |
download | metamuffin-blog-a4dd9c4944340505962f07853d53ab02f3a02336.tar metamuffin-blog-a4dd9c4944340505962f07853d53ab02f3a02336.tar.bz2 metamuffin-blog-a4dd9c4944340505962f07853d53ab02f3a02336.tar.zst |
set title
Diffstat (limited to 'code/src')
-rw-r--r-- | code/src/main.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/code/src/main.rs b/code/src/main.rs index 6e281df..d90139e 100644 --- a/code/src/main.rs +++ b/code/src/main.rs @@ -26,9 +26,8 @@ fn main() { let args = Args::parse(); match args.action { ArgAction::RenderArticle { input } => { - let md_source = read_to_string(input).unwrap(); let mut out = Buffer::new(); - article(md_source).render(&mut out); + article(input).render(&mut out); write_output(&args.output, out.into_string()); } ArgAction::RenderIndex { root } => { @@ -52,7 +51,7 @@ fn scaffold(title: String, body: impl Render) -> impl Render { html!( head!( link!(rel = "stylesheet", href = "./style.css"), - title!(title) + title!(format!("{} - metamuffin's blog", title)) ), body!( nav!(h2!("metamuffin's blog"), a!(href = "./index.html", "index")), @@ -88,10 +87,12 @@ fn article_title(path: PathBuf) -> String { String::from(&buf[2..]) } -fn article(md_source: String) -> impl Render { +fn article(path: String) -> impl Render { scaffold( - "blub".to_string(), - raw!(blocks_to_html(markdown::tokenize(&md_source))), + article_title(path.clone().into()), + raw!(blocks_to_html(markdown::tokenize( + &read_to_string(path).unwrap() + ))), ) } |