summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock6
-rw-r--r--Cargo.toml1
-rw-r--r--src/generate_html.rs9
3 files changed, 16 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 503e64a..d4f3222 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,10 +8,16 @@ version = "2.1.1"
source = "git+git://benbridle.com/markdown?tag=v2.1.1#259eeb0094b70d80cb8300707fe89f5adf554b1d"
[[package]]
+name = "recipe"
+version = "1.4.0"
+source = "git+git://benbridle.com/recipe?tag=v1.4.0#652aaee3130e2ee02742fdcc248ddd1bee285737"
+
+[[package]]
name = "toaster"
version = "1.4.0"
dependencies = [
"markdown",
+ "recipe",
"vagabond",
"xflags",
]
diff --git a/Cargo.toml b/Cargo.toml
index 35cd9b1..e168246 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,6 +6,7 @@ edition = "2021"
[dependencies]
vagabond = { git = "git://benbridle.com/vagabond", tag = "v1.0.2" }
markdown = { git = "git://benbridle.com/markdown", tag = "v2.1.1" }
+recipe = { git = "git://benbridle.com/recipe", tag = "v1.4.0" }
xflags = "0.4.0-pre.1"
[profile.release]
diff --git a/src/generate_html.rs b/src/generate_html.rs
index dd08885..19cf9a5 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -1,6 +1,7 @@
use crate::*;
use markdown::*;
+use recipe::*;
pub fn generate_html(document: &MarkdownDocument, page: &Page, website: &Website) -> String {
@@ -168,6 +169,14 @@ 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" => (),
+ "recipe" => {
+ let recipe = Recipe::parse(content);
+ html!("<div class='recipe'><ul>");
+ for ingredient in recipe.ingredients { html!("<li>{ingredient}</li>") }
+ html!("</ul><hr>");
+ for paragraph in recipe.process { html!("<p>{paragraph}</p>") }
+ html!("</div>");
+ },
_ => {
html!("<pre class='{}'>", language);
html!("{}", sanitize_text(content));