summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscottj <jones.scott0391@gmail.com>2021-08-19 23:25:11 -0700
committerscottj <jones.scott0391@gmail.com>2021-08-19 23:25:11 -0700
commit5bd2c787d014e69e64390fcae0236838f6c78fb7 (patch)
tree71c606bdd79b622b45c8d715a618b2de09bf196b
parentcaf0729f04f3e61845fe10e88c2940daba5ac020 (diff)
setup ruby code to build a separate page for each recipe when website build file is run.
-rwxr-xr-xbin/build_blog3
-rwxr-xr-xbin/build_posts3
-rwxr-xr-xbin/build_recipe_directory3
-rw-r--r--build_posts.rb47
-rw-r--r--build_recipe_directory.rb (renamed from build_blog.rb)2
-rwxr-xr-xbuild_website.sh3
-rw-r--r--content/posts/banana-muffins.md (renamed from content/posts/banana-muffins-loaf.md)0
-rw-r--r--content/posts/maple-bread.md (renamed from content/posts/yeasted-bread-loaf.md)2
-rw-r--r--output/banana-muffins.md.html59
-rw-r--r--output/maple-bread.md.html67
-rw-r--r--output/recipes.html66
-rw-r--r--recipe-directory-template.html.erb14
-rw-r--r--recipe-template.html.erb2
13 files changed, 231 insertions, 40 deletions
diff --git a/bin/build_blog b/bin/build_blog
deleted file mode 100755
index cd9e7dc..0000000
--- a/bin/build_blog
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env bash
-
-ruby build_blog.rb > output/recipes.html
diff --git a/bin/build_posts b/bin/build_posts
new file mode 100755
index 0000000..1655944
--- /dev/null
+++ b/bin/build_posts
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+ruby build_posts.rb
diff --git a/bin/build_recipe_directory b/bin/build_recipe_directory
new file mode 100755
index 0000000..91a4cf0
--- /dev/null
+++ b/bin/build_recipe_directory
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+ruby build_recipe_directory.rb > output/recipes.html
diff --git a/build_posts.rb b/build_posts.rb
new file mode 100644
index 0000000..53a18ac
--- /dev/null
+++ b/build_posts.rb
@@ -0,0 +1,47 @@
+require 'erb'
+require 'kramdown'
+
+def render(partial_path)
+ ERB.new(File.read(partial_path)).result(binding)
+end
+
+def content
+ output = Array.new
+ Dir.foreach("./content/posts") do |post_filename|
+ if post_filename.include?("md")
+ output.push(Kramdown::Document.new(File.read("./content/posts/#{post_filename}")).to_html)
+ end
+ end
+ return output
+end
+
+def filename
+ file = Array.new
+ Dir.foreach("./content/posts") do |post_filename|
+ if post_filename.include?("md")
+ file.push("output/#{post_filename}.html")
+ end
+ end
+ return file
+end
+
+
+i = 0
+while (i < content.length)
+ @content = content[i]
+ template = ERB.new(File.read('recipe-template.html.erb'))
+ puts template.result(binding)
+ file = filename[i]
+ File.open(file, 'w') do |f|
+ f.write(template.result)
+ end
+ i += 1
+end
+
+=begin
+filename.each do |file|
+ File.open(file, 'w') do |f|
+ f.write(template.result)
+ end
+end
+=end \ No newline at end of file
diff --git a/build_blog.rb b/build_recipe_directory.rb
index d0cc293..433e179 100644
--- a/build_blog.rb
+++ b/build_recipe_directory.rb
@@ -15,5 +15,5 @@ def content
return output
end
-template = ERB.new(File.read('recipe-template.html.erb'))
+template = ERB.new(File.read('recipe-directory-template.html.erb'))
puts template.result(binding)
diff --git a/build_website.sh b/build_website.sh
index ede3690..f9b062b 100755
--- a/build_website.sh
+++ b/build_website.sh
@@ -2,4 +2,5 @@
bin/build_index
bin/build_about
-bin/build_blog \ No newline at end of file
+bin/build_blog
+bin/build_posts \ No newline at end of file
diff --git a/content/posts/banana-muffins-loaf.md b/content/posts/banana-muffins.md
index e09b03a..e09b03a 100644
--- a/content/posts/banana-muffins-loaf.md
+++ b/content/posts/banana-muffins.md
diff --git a/content/posts/yeasted-bread-loaf.md b/content/posts/maple-bread.md
index 82833ba..8ba0851 100644
--- a/content/posts/yeasted-bread-loaf.md
+++ b/content/posts/maple-bread.md
@@ -1,4 +1,4 @@
-# Quick Vegan Yeasted Whole Wheat Bread {#recipe-title}
+# Quick Vegan Whole Wheat Maple Bread {#recipe-title}
<div markdown=1 class="image-and-text">
diff --git a/output/banana-muffins.md.html b/output/banana-muffins.md.html
new file mode 100644
index 0000000..fb05606
--- /dev/null
+++ b/output/banana-muffins.md.html
@@ -0,0 +1,59 @@
+<html>
+ <head>
+ <title>Pantry of Plants</title>
+ <link rel="stylesheet" href="../style/style.css">
+ <script src="../scripts/image-slide.js" defer></script>
+ </head>
+ <body>
+ <header>
+ <nav>
+ <a href="index.html"><img src="../images/pantry-of-plants-logo.png" class="logo"></a>
+ <div class="nav-text-outer">
+ <a href="recipes.html" class="nav-text">Recipes</a>
+ <a href="about.html" class="nav-text">About</a>
+ </div>
+ </nav>
+</header>
+
+ <div class="content">
+ <h1 id="recipe-title">Vegan Banana Loaf / Muffins</h1>
+
+<div class="image-and-text">
+
+<img src="../images/placeholder/home3.jpg" class="image">
+
+ <div class="text">
+
+ <h2 id="ingredients">Ingredients</h2>
+ <ul>
+ <li>1/4 cup Oil (Coconut or other)</li>
+ <li>1 cup Sugar</li>
+ <li>3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup</li>
+ <li>1/2 cup white flour</li>
+ <li>1 cup whole wheat flour</li>
+ <li>1/4 tsp salt</li>
+ <li>1 tsp baking soda</li>
+ <li>Vegan ‘Dairy Free’ chocolate chips (optional)</li>
+ </ul>
+
+ <h2 id="instructions">Instructions</h2>
+ <ol>
+ <li>Heat oven to 350 degrees fahrenheit.</li>
+ <li>Cream oil and sugar.</li>
+ <li>Add mashed banana and baking soda.</li>
+ <li>Add flour and salt and mix until combined.</li>
+ <li>Add chocolate chips if desired.</li>
+ </ol>
+
+ </div>
+
+</div>
+
+ </div>
+ <footer>
+ <a href="mailto:scott@pantryofplants.ca" class="mail">Contact: scott@pantryofplants.ca <img src="../images/mail.svg" class="mail-2"></a>
+ <p>© 2021 Pantry of Plants</p>
+</footer>
+
+ </body>
+</html>
diff --git a/output/maple-bread.md.html b/output/maple-bread.md.html
new file mode 100644
index 0000000..6bceebb
--- /dev/null
+++ b/output/maple-bread.md.html
@@ -0,0 +1,67 @@
+<html>
+ <head>
+ <title>Pantry of Plants</title>
+ <link rel="stylesheet" href="../style/style.css">
+ <script src="../scripts/image-slide.js" defer></script>
+ </head>
+ <body>
+ <header>
+ <nav>
+ <a href="index.html"><img src="../images/pantry-of-plants-logo.png" class="logo"></a>
+ <div class="nav-text-outer">
+ <a href="recipes.html" class="nav-text">Recipes</a>
+ <a href="about.html" class="nav-text">About</a>
+ </div>
+ </nav>
+</header>
+
+ <div class="content">
+ <h1 id="recipe-title">Quick Vegan Whole Wheat Maple Bread</h1>
+
+<div class="image-and-text">
+
+<img src="../images/recipe-images/bread-3.jpg" class="image">
+
+ <div class="text">
+
+ <h2 id="description">Description</h2>
+ <p>This recipe is for a single loaf of whole wheat bread. This recipe is quick and easy! We will use the oven to do our dough rise which will save both time and effort.</p>
+
+ <h2 id="ingredients-1-loaf">Ingredients (1 loaf)</h2>
+ <ul>
+ <li>1/2 Tablespoon Active Dry Yeast or Traditional Yeast</li>
+ <li>1/3 cup Maple Syrup or Sugar (any form of sugar will work)</li>
+ <li>1 and 1/2 Cups or 425ml Warm Water</li>
+ <li>50ml (approx 1/6 cup) of Olive Oil</li>
+ <li>2 cups Whole Wheat Flour</li>
+ <li>1 and 3/4 cups White Flour</li>
+ <li>1/2 Tablespoon Salt</li>
+ <li>Extra Olive Oil and Salt to spread on top of bread</li>
+ </ul>
+
+ <h2 id="instructions">Instructions</h2>
+ <ol>
+ <li>Heat oven to 200 degrees fahrenheit. Warm a standard sized loaf pan (approx 8-1/2 x 4-1/2 x 2-1/2 inches – cast iron or non stick) in oven. Add Olive oil and cornmeal to the bottom of the pan.</li>
+ <li>Add yeast and sweetener of choice (sugar or maple syrup) to mixing bowl. Poor in warm water and give the mixture a few stirs. Let the yeast proof for about 5 minutes. (It should look foamy when it’s done).</li>
+ <li>Add the Olive Oil to the wet mixture.</li>
+ <li>Add the flour and salt to a large mixing bowl or stand mixer if you have one.</li>
+ <li>Add the wet ingredients to the dry.</li>
+ <li>If using a stand mixer, knead the dough for about 5 minutes. If you are kneading by hand it should take around 100 to 200 turns.</li>
+ <li>Place a little oil on your hands and shape dough into a loaf. Add 3 diagonal score marks to the top of the loaf. Cover load with Olive Oil and salt and place the pan in the warm oven to rise. After 20 minutes it should be doubled in size.</li>
+ <li>After the 20 minutes, turn oven to 350 degrees fahrenheit. Leave bread in oven and set your timer for 35 minutes.</li>
+ <li>Once the bread is golden brown it is done. Remove the loaf from the oven, brush top with Olive Oil, remove from pan and cool on a cooling rack.</li>
+ <li>Enjoy :)</li>
+ </ol>
+
+ </div>
+
+</div>
+
+ </div>
+ <footer>
+ <a href="mailto:scott@pantryofplants.ca" class="mail">Contact: scott@pantryofplants.ca <img src="../images/mail.svg" class="mail-2"></a>
+ <p>© 2021 Pantry of Plants</p>
+</footer>
+
+ </body>
+</html>
diff --git a/output/recipes.html b/output/recipes.html
index 0d30457..01e10c7 100644
--- a/output/recipes.html
+++ b/output/recipes.html
@@ -16,39 +16,7 @@
</header>
<div class="content">
- <h1 id="recipe-title">Vegan Banana Loaf / Muffins</h1>
-
-<div class="image-and-text">
-
-<img src="../images/placeholder/home3.jpg" class="image">
-
- <div class="text">
-
- <h2 id="ingredients">Ingredients</h2>
- <ul>
- <li>1/4 cup Oil (Coconut or other)</li>
- <li>1 cup Sugar</li>
- <li>3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup</li>
- <li>1/2 cup white flour</li>
- <li>1 cup whole wheat flour</li>
- <li>1/4 tsp salt</li>
- <li>1 tsp baking soda</li>
- <li>Vegan ‘Dairy Free’ chocolate chips (optional)</li>
- </ul>
-
- <h2 id="instructions">Instructions</h2>
- <ol>
- <li>Heat oven to 350 degrees fahrenheit.</li>
- <li>Cream oil and sugar.</li>
- <li>Add mashed banana and baking soda.</li>
- <li>Add flour and salt and mix until combined.</li>
- <li>Add chocolate chips if desired.</li>
- </ol>
-
- </div>
-
-</div>
-<h1 id="recipe-title">Quick Vegan Yeasted Whole Wheat Bread</h1>
+ <h1 id="recipe-title">Quick Vegan Whole Wheat Maple Bread</h1>
<div class="image-and-text">
@@ -88,6 +56,38 @@
</div>
</div>
+<h1 id="recipe-title">Vegan Banana Loaf / Muffins</h1>
+
+<div class="image-and-text">
+
+<img src="../images/placeholder/home3.jpg" class="image">
+
+ <div class="text">
+
+ <h2 id="ingredients">Ingredients</h2>
+ <ul>
+ <li>1/4 cup Oil (Coconut or other)</li>
+ <li>1 cup Sugar</li>
+ <li>3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup</li>
+ <li>1/2 cup white flour</li>
+ <li>1 cup whole wheat flour</li>
+ <li>1/4 tsp salt</li>
+ <li>1 tsp baking soda</li>
+ <li>Vegan ‘Dairy Free’ chocolate chips (optional)</li>
+ </ul>
+
+ <h2 id="instructions">Instructions</h2>
+ <ol>
+ <li>Heat oven to 350 degrees fahrenheit.</li>
+ <li>Cream oil and sugar.</li>
+ <li>Add mashed banana and baking soda.</li>
+ <li>Add flour and salt and mix until combined.</li>
+ <li>Add chocolate chips if desired.</li>
+ </ol>
+
+ </div>
+
+</div>
</div>
<footer>
diff --git a/recipe-directory-template.html.erb b/recipe-directory-template.html.erb
new file mode 100644
index 0000000..55d0c7c
--- /dev/null
+++ b/recipe-directory-template.html.erb
@@ -0,0 +1,14 @@
+<html>
+ <head>
+ <title>Pantry of Plants</title>
+ <link rel="stylesheet" href="../style/style.css">
+ <script src="../scripts/image-slide.js" defer></script>
+ </head>
+ <body>
+ <%= render "header.html.erb" %>
+ <div class="content">
+ <%= content %>
+ </div>
+ <%= render "footer.html.erb" %>
+ </body>
+</html>
diff --git a/recipe-template.html.erb b/recipe-template.html.erb
index 55d0c7c..2ef2340 100644
--- a/recipe-template.html.erb
+++ b/recipe-template.html.erb
@@ -7,7 +7,7 @@
<body>
<%= render "header.html.erb" %>
<div class="content">
- <%= content %>
+ <%= @content %>
</div>
<%= render "footer.html.erb" %>
</body>