diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2025-02-08 12:22:27 +1300 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2025-02-08 12:22:27 +1300 |
commit | 1a33dca75d0d13cc7a4d2886af80fa2c1b0243a9 (patch) | |
tree | 0de60b1b987a8ed650abba2a7e112c63435de104 /src | |
parent | 6e13f2875055b77c1b29c5c75c328306ed50186c (diff) | |
download | toaster-1a33dca75d0d13cc7a4d2886af80fa2c1b0243a9.zip |
Implement poem syntax fragment
Diffstat (limited to 'src')
-rw-r--r-- | src/generate_html.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs index dca68f7..8198e5c 100644 --- a/src/generate_html.rs +++ b/src/generate_html.rs @@ -193,6 +193,13 @@ pub fn document_to_html(document: &MarkdownDocument, page: &Page, website: &Webs "embed-css" => wrap!("style", html!("{content}")), "embed-javascript"|"embed-js" => wrap!("script", html!("{content}")), "hidden"|"todo"|"embed-html-head" => (), + "poem" => wrap!("div", "class='poem'", for line in content.lines() { + let line = line.trim_end(); + match line.is_empty() { + true => html!("<br>"), + false => html!("<p>{}</p>", sanitize_text(line, true)), + } + }), "recipe" => { let recipe = Recipe::parse(content); html!("<div class='recipe'><ul>"); |