diff options
-rw-r--r-- | code/src/html.rs | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/code/src/html.rs b/code/src/html.rs index e133528..310b8a4 100644 --- a/code/src/html.rs +++ b/code/src/html.rs @@ -3,7 +3,7 @@ use crate::{ markdown::{self}, ArticleMeta, }; -use laby::{frag, html, iter, li, ul, Render}; +use laby::{frag, html, iter, li, Render}; use std::fs::read_to_string; pub fn scaffold(title: String, body: impl Render) -> impl Render { @@ -27,22 +27,21 @@ pub fn scaffold(title: String, body: impl Render) -> impl Render { } pub fn article(path: String) -> impl Render { - // match parsers::markdown::Grammar::parse( - // parsers::markdown::Rule::file, - // &read_to_string(&path).unwrap(), - // ) { - // Ok(ast) => eprintln!("{ast:#?}"), - // Err(e) => panic!("{e}"), - // } - scaffold( article_metadata(path.clone().into()).title, frag!( - laby::raw!(markdown::render( - &read_to_string(&path).unwrap() - )), + laby::raw!(markdown::render(&read_to_string(&path).unwrap())), hr!(), - p!("changes to this article (as recorded with git; visible on the git repo, that i will create soon)"), + p!( + "changes to this article (as recorded with git; visible ", + a!( + href = format!( + "https://codeberg.org/metamuffin/blog/commits/branch/master/content/{path}" + ), + "on codeberg" + ), + ")" + ), pre!(file_history(&path)) ), ) @@ -51,22 +50,28 @@ pub fn article(path: String) -> impl Render { pub fn index(root: &str) -> impl Render { scaffold( "index".to_string(), - ul!(iter!({ - get_articles(&root).into_iter().map( - |ArticleMeta { - canonical_name, - date, - title, - .. - }| { - li!( - date.to_string(), - ": ", - a!(href = format!("./{canonical_name}",), title) - ) - }, - ) - })), + frag!( + p!( + "This is my personal blog. The sources (including all the tooling) are available ", + a!(href = "https://codeberg.org/metamuffin/blog", "on codeberg") + ), + ul!(iter!({ + get_articles(&root).into_iter().map( + |ArticleMeta { + canonical_name, + date, + title, + .. + }| { + li!( + date.to_string(), + ": ", + a!(href = format!("./{canonical_name}",), title) + ) + }, + ) + })) + ), ) } |