From da2a95bec7540db923176ae66b8e604011e975e7 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 29 Aug 2022 17:45:29 +0200 Subject: more stuff --- code/src/main.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'code/src/main.rs') diff --git a/code/src/main.rs b/code/src/main.rs index bbc0e89..6e281df 100644 --- a/code/src/main.rs +++ b/code/src/main.rs @@ -56,7 +56,8 @@ fn scaffold(title: String, body: impl Render) -> impl Render { ), body!( nav!(h2!("metamuffin's blog"), a!(href = "./index.html", "index")), - article!(body) + article!(body), + footer!(p!("written by metamuffin, licensed under CC-BY-ND-4.0")) ) ) } @@ -116,15 +117,15 @@ fn blocks_to_html(blocks: Vec) -> String { let mut out = String::new(); for e in blocks { out += match e { - markdown::Block::Header(text, level) => { + Block::Header(text, level) => { format!("{}", span_to_html(text)) } - markdown::Block::Paragraph(p) => format!("

{}

", span_to_html(p)), - markdown::Block::Blockquote(q) => format!("{}", blocks_to_html(q)), - markdown::Block::CodeBlock(_syntax, content) => { + Block::Paragraph(p) => format!("

{}

", span_to_html(p)), + Block::Blockquote(q) => format!("{}", blocks_to_html(q)), + Block::CodeBlock(_syntax, content) => { format!("
{}
", escape(&content)) // TODO syntax highlighting } - markdown::Block::OrderedList(els, _) => format!( + Block::OrderedList(els, _) => format!( "
    {}
", els.into_iter() .map(|e| format!( @@ -137,7 +138,7 @@ fn blocks_to_html(blocks: Vec) -> String { .collect::>() .join("") ), - markdown::Block::UnorderedList(els) => { + Block::UnorderedList(els) => { format!( "
    {}
", els.into_iter() @@ -152,8 +153,8 @@ fn blocks_to_html(blocks: Vec) -> String { .join("") ) } - markdown::Block::Raw(r) => r, - markdown::Block::Hr => format!("
"), + Block::Raw(r) => r, + Block::Hr => format!("
"), } .as_str(); } -- cgit v1.2.3-70-g09d2