From 5bd2c787d014e69e64390fcae0236838f6c78fb7 Mon Sep 17 00:00:00 2001 From: scottj Date: Thu, 19 Aug 2021 23:25:11 -0700 Subject: setup ruby code to build a separate page for each recipe when website build file is run. --- bin/build_blog | 3 -- bin/build_posts | 3 ++ bin/build_recipe_directory | 3 ++ build_blog.rb | 19 ---------- build_posts.rb | 47 +++++++++++++++++++++++++ build_recipe_directory.rb | 19 ++++++++++ build_website.sh | 3 +- content/posts/banana-muffins-loaf.md | 31 ----------------- content/posts/banana-muffins.md | 31 +++++++++++++++++ content/posts/maple-bread.md | 38 ++++++++++++++++++++ content/posts/yeasted-bread-loaf.md | 38 -------------------- output/banana-muffins.md.html | 59 +++++++++++++++++++++++++++++++ output/maple-bread.md.html | 67 ++++++++++++++++++++++++++++++++++++ output/recipes.html | 66 +++++++++++++++++------------------ recipe-directory-template.html.erb | 14 ++++++++ recipe-template.html.erb | 2 +- 16 files changed, 317 insertions(+), 126 deletions(-) delete mode 100755 bin/build_blog create mode 100755 bin/build_posts create mode 100755 bin/build_recipe_directory delete mode 100644 build_blog.rb create mode 100644 build_posts.rb create mode 100644 build_recipe_directory.rb delete mode 100644 content/posts/banana-muffins-loaf.md create mode 100644 content/posts/banana-muffins.md create mode 100644 content/posts/maple-bread.md delete mode 100644 content/posts/yeasted-bread-loaf.md create mode 100644 output/banana-muffins.md.html create mode 100644 output/maple-bread.md.html create mode 100644 recipe-directory-template.html.erb 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_blog.rb b/build_blog.rb deleted file mode 100644 index d0cc293..0000000 --- a/build_blog.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'erb' -require 'kramdown' - -def render(partial_path) - ERB.new(File.read(partial_path)).result(binding) -end - -def content - output = "" - Dir.foreach("./content/posts") do |post_filename| - if post_filename.include?("md") - output.concat(Kramdown::Document.new(File.read("./content/posts/#{post_filename}")).to_html) - end - end - return output -end - -template = ERB.new(File.read('recipe-template.html.erb')) -puts template.result(binding) 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_recipe_directory.rb b/build_recipe_directory.rb new file mode 100644 index 0000000..433e179 --- /dev/null +++ b/build_recipe_directory.rb @@ -0,0 +1,19 @@ +require 'erb' +require 'kramdown' + +def render(partial_path) + ERB.new(File.read(partial_path)).result(binding) +end + +def content + output = "" + Dir.foreach("./content/posts") do |post_filename| + if post_filename.include?("md") + output.concat(Kramdown::Document.new(File.read("./content/posts/#{post_filename}")).to_html) + end + end + return output +end + +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-loaf.md deleted file mode 100644 index e09b03a..0000000 --- a/content/posts/banana-muffins-loaf.md +++ /dev/null @@ -1,31 +0,0 @@ -# Vegan Banana Loaf / Muffins {#recipe-title} - -
- -{::nomarkdown} - -{:/} - -
- -## Ingredients -- 1/4 cup Oil (Coconut or other) -- 1 cup Sugar -- 3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup -- 1/2 cup white flour -- 1 cup whole wheat flour -- 1/4 tsp salt -- 1 tsp baking soda -- Vegan 'Dairy Free' chocolate chips (optional) - -##Instructions -1. Heat oven to 350 degrees fahrenheit. -2. Cream oil and sugar. -3. Add mashed banana and baking soda. -4. Add flour and salt and mix until combined. -5. Add chocolate chips if desired. - - -
- -
\ No newline at end of file diff --git a/content/posts/banana-muffins.md b/content/posts/banana-muffins.md new file mode 100644 index 0000000..e09b03a --- /dev/null +++ b/content/posts/banana-muffins.md @@ -0,0 +1,31 @@ +# Vegan Banana Loaf / Muffins {#recipe-title} + +
+ +{::nomarkdown} + +{:/} + +
+ +## Ingredients +- 1/4 cup Oil (Coconut or other) +- 1 cup Sugar +- 3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup +- 1/2 cup white flour +- 1 cup whole wheat flour +- 1/4 tsp salt +- 1 tsp baking soda +- Vegan 'Dairy Free' chocolate chips (optional) + +##Instructions +1. Heat oven to 350 degrees fahrenheit. +2. Cream oil and sugar. +3. Add mashed banana and baking soda. +4. Add flour and salt and mix until combined. +5. Add chocolate chips if desired. + + +
+ +
\ No newline at end of file diff --git a/content/posts/maple-bread.md b/content/posts/maple-bread.md new file mode 100644 index 0000000..8ba0851 --- /dev/null +++ b/content/posts/maple-bread.md @@ -0,0 +1,38 @@ +# Quick Vegan Whole Wheat Maple Bread {#recipe-title} + +
+ +{::nomarkdown} + +{:/} + +
+ +##Description +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. + +## Ingredients (1 loaf) +- 1/2 Tablespoon Active Dry Yeast or Traditional Yeast +- 1/3 cup Maple Syrup or Sugar (any form of sugar will work) +- 1 and 1/2 Cups or 425ml Warm Water +- 50ml (approx 1/6 cup) of Olive Oil +- 2 cups Whole Wheat Flour +- 1 and 3/4 cups White Flour +- 1/2 Tablespoon Salt +- Extra Olive Oil and Salt to spread on top of bread + +##Instructions +1. 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. +2. 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). +3. Add the Olive Oil to the wet mixture. +4. Add the flour and salt to a large mixing bowl or stand mixer if you have one. +5. Add the wet ingredients to the dry. +6. 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. +7. 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. +8. After the 20 minutes, turn oven to 350 degrees fahrenheit. Leave bread in oven and set your timer for 35 minutes. +9. 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. +10. Enjoy :) + +
+ +
diff --git a/content/posts/yeasted-bread-loaf.md b/content/posts/yeasted-bread-loaf.md deleted file mode 100644 index 82833ba..0000000 --- a/content/posts/yeasted-bread-loaf.md +++ /dev/null @@ -1,38 +0,0 @@ -# Quick Vegan Yeasted Whole Wheat Bread {#recipe-title} - -
- -{::nomarkdown} - -{:/} - -
- -##Description -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. - -## Ingredients (1 loaf) -- 1/2 Tablespoon Active Dry Yeast or Traditional Yeast -- 1/3 cup Maple Syrup or Sugar (any form of sugar will work) -- 1 and 1/2 Cups or 425ml Warm Water -- 50ml (approx 1/6 cup) of Olive Oil -- 2 cups Whole Wheat Flour -- 1 and 3/4 cups White Flour -- 1/2 Tablespoon Salt -- Extra Olive Oil and Salt to spread on top of bread - -##Instructions -1. 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. -2. 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). -3. Add the Olive Oil to the wet mixture. -4. Add the flour and salt to a large mixing bowl or stand mixer if you have one. -5. Add the wet ingredients to the dry. -6. 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. -7. 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. -8. After the 20 minutes, turn oven to 350 degrees fahrenheit. Leave bread in oven and set your timer for 35 minutes. -9. 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. -10. Enjoy :) - -
- -
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 @@ + + + Pantry of Plants + + + + +
+ +
+ +
+

Vegan Banana Loaf / Muffins

+ +
+ + + +
+ +

Ingredients

+
    +
  • 1/4 cup Oil (Coconut or other)
  • +
  • 1 cup Sugar
  • +
  • 3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup
  • +
  • 1/2 cup white flour
  • +
  • 1 cup whole wheat flour
  • +
  • 1/4 tsp salt
  • +
  • 1 tsp baking soda
  • +
  • Vegan ‘Dairy Free’ chocolate chips (optional)
  • +
+ +

Instructions

+
    +
  1. Heat oven to 350 degrees fahrenheit.
  2. +
  3. Cream oil and sugar.
  4. +
  5. Add mashed banana and baking soda.
  6. +
  7. Add flour and salt and mix until combined.
  8. +
  9. Add chocolate chips if desired.
  10. +
+ +
+ +
+ +
+ + + + 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 @@ + + + Pantry of Plants + + + + +
+ +
+ +
+

Quick Vegan Whole Wheat Maple Bread

+ +
+ + + +
+ +

Description

+

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.

+ +

Ingredients (1 loaf)

+
    +
  • 1/2 Tablespoon Active Dry Yeast or Traditional Yeast
  • +
  • 1/3 cup Maple Syrup or Sugar (any form of sugar will work)
  • +
  • 1 and 1/2 Cups or 425ml Warm Water
  • +
  • 50ml (approx 1/6 cup) of Olive Oil
  • +
  • 2 cups Whole Wheat Flour
  • +
  • 1 and 3/4 cups White Flour
  • +
  • 1/2 Tablespoon Salt
  • +
  • Extra Olive Oil and Salt to spread on top of bread
  • +
+ +

Instructions

+
    +
  1. 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.
  2. +
  3. 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).
  4. +
  5. Add the Olive Oil to the wet mixture.
  6. +
  7. Add the flour and salt to a large mixing bowl or stand mixer if you have one.
  8. +
  9. Add the wet ingredients to the dry.
  10. +
  11. 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.
  12. +
  13. 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.
  14. +
  15. After the 20 minutes, turn oven to 350 degrees fahrenheit. Leave bread in oven and set your timer for 35 minutes.
  16. +
  17. 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.
  18. +
  19. Enjoy :)
  20. +
+ +
+ +
+ +
+ + + + 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 @@
-

Vegan Banana Loaf / Muffins

- -
- - - -
- -

Ingredients

-
    -
  • 1/4 cup Oil (Coconut or other)
  • -
  • 1 cup Sugar
  • -
  • 3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup
  • -
  • 1/2 cup white flour
  • -
  • 1 cup whole wheat flour
  • -
  • 1/4 tsp salt
  • -
  • 1 tsp baking soda
  • -
  • Vegan ‘Dairy Free’ chocolate chips (optional)
  • -
- -

Instructions

-
    -
  1. Heat oven to 350 degrees fahrenheit.
  2. -
  3. Cream oil and sugar.
  4. -
  5. Add mashed banana and baking soda.
  6. -
  7. Add flour and salt and mix until combined.
  8. -
  9. Add chocolate chips if desired.
  10. -
- -
- -
-

Quick Vegan Yeasted Whole Wheat Bread

+

Quick Vegan Whole Wheat Maple Bread

@@ -87,6 +55,38 @@
+
+

Vegan Banana Loaf / Muffins

+ +
+ + + +
+ +

Ingredients

+
    +
  • 1/4 cup Oil (Coconut or other)
  • +
  • 1 cup Sugar
  • +
  • 3 or 4 bananas (depending on size: 3 large or 4 small) Approx: 1 cup
  • +
  • 1/2 cup white flour
  • +
  • 1 cup whole wheat flour
  • +
  • 1/4 tsp salt
  • +
  • 1 tsp baking soda
  • +
  • Vegan ‘Dairy Free’ chocolate chips (optional)
  • +
+ +

Instructions

+
    +
  1. Heat oven to 350 degrees fahrenheit.
  2. +
  3. Cream oil and sugar.
  4. +
  5. Add mashed banana and baking soda.
  6. +
  7. Add flour and salt and mix until combined.
  8. +
  9. Add chocolate chips if desired.
  10. +
+ +
+
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 @@ + + + Pantry of Plants + + + + + <%= render "header.html.erb" %> +
+ <%= content %> +
+ <%= render "footer.html.erb" %> + + 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 @@ <%= render "header.html.erb" %>
- <%= content %> + <%= @content %>
<%= render "footer.html.erb" %> -- cgit v1.2.3