From c3011d75e8abd6c4665dc94447f7a6b5df3ca49a Mon Sep 17 00:00:00 2001 From: scottj Date: Sat, 21 Aug 2021 13:01:57 -0700 Subject: cleaned up file organization --- bin/build_about | 2 +- bin/build_index | 2 +- bin/build_posts | 2 +- bin/build_recipe_directory | 2 +- build-files/build_about.rb | 19 ++++++++++++++++++ build-files/build_index.rb | 19 ++++++++++++++++++ build-files/build_posts.rb | 38 +++++++++++++++++++++++++++++++++++ build-files/build_recipe_directory.rb | 19 ++++++++++++++++++ build_about.rb | 19 ------------------ build_index.rb | 19 ------------------ build_posts.rb | 38 ----------------------------------- build_recipe_directory.rb | 19 ------------------ footer.html.erb | 4 ---- head.html.erb | 5 ----- header.html.erb | 9 --------- partials/footer.html.erb | 4 ++++ partials/head.html.erb | 5 +++++ partials/header.html.erb | 9 +++++++++ recipe-directory-template.html.erb | 6 +++--- recipe-template.html.erb | 6 +++--- template.html.erb | 6 +++--- 21 files changed, 126 insertions(+), 126 deletions(-) create mode 100644 build-files/build_about.rb create mode 100644 build-files/build_index.rb create mode 100644 build-files/build_posts.rb create mode 100644 build-files/build_recipe_directory.rb delete mode 100644 build_about.rb delete mode 100644 build_index.rb delete mode 100644 build_posts.rb delete mode 100644 build_recipe_directory.rb delete mode 100644 footer.html.erb delete mode 100644 head.html.erb delete mode 100644 header.html.erb create mode 100644 partials/footer.html.erb create mode 100644 partials/head.html.erb create mode 100644 partials/header.html.erb diff --git a/bin/build_about b/bin/build_about index 06d251e..da7cda8 100755 --- a/bin/build_about +++ b/bin/build_about @@ -1,3 +1,3 @@ #!/usr/bin/env bash -ruby build_about.rb > output/about.html +ruby build-files/build_about.rb > output/about.html diff --git a/bin/build_index b/bin/build_index index bf2025c..12b2e5a 100755 --- a/bin/build_index +++ b/bin/build_index @@ -1,3 +1,3 @@ #!/usr/bin/env bash -ruby build_index.rb > output/index.html +ruby build-files/build_index.rb > output/index.html diff --git a/bin/build_posts b/bin/build_posts index 1655944..c7d213b 100755 --- a/bin/build_posts +++ b/bin/build_posts @@ -1,3 +1,3 @@ #!/usr/bin/env bash -ruby build_posts.rb +ruby build-files/build_posts.rb diff --git a/bin/build_recipe_directory b/bin/build_recipe_directory index 91a4cf0..caefbb2 100755 --- a/bin/build_recipe_directory +++ b/bin/build_recipe_directory @@ -1,3 +1,3 @@ #!/usr/bin/env bash -ruby build_recipe_directory.rb > output/recipes.html +ruby build-files/build_recipe_directory.rb > output/recipes.html diff --git a/build-files/build_about.rb b/build-files/build_about.rb new file mode 100644 index 0000000..5e56ab7 --- /dev/null +++ b/build-files/build_about.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/main-pages") do |post_filename| + if post_filename.include?("about.md") + output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{post_filename}")).to_html) + end + end + return output +end + +template = ERB.new(File.read('template.html.erb')) +puts template.result(binding) \ No newline at end of file diff --git a/build-files/build_index.rb b/build-files/build_index.rb new file mode 100644 index 0000000..aae1268 --- /dev/null +++ b/build-files/build_index.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/main-pages") do |post_filename| + if post_filename.include?("index.md") + output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{post_filename}")).to_html) + end + end + return output +end + +template = ERB.new(File.read('template.html.erb')) +puts template.result(binding) \ No newline at end of file diff --git a/build-files/build_posts.rb b/build-files/build_posts.rb new file mode 100644 index 0000000..ec03b77 --- /dev/null +++ b/build-files/build_posts.rb @@ -0,0 +1,38 @@ +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 \ No newline at end of file diff --git a/build-files/build_recipe_directory.rb b/build-files/build_recipe_directory.rb new file mode 100644 index 0000000..de61f4f --- /dev/null +++ b/build-files/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/main-pages") do |post_filename| + if post_filename.include?("recipes.md") + output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{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_about.rb b/build_about.rb deleted file mode 100644 index 5e56ab7..0000000 --- a/build_about.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/main-pages") do |post_filename| - if post_filename.include?("about.md") - output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{post_filename}")).to_html) - end - end - return output -end - -template = ERB.new(File.read('template.html.erb')) -puts template.result(binding) \ No newline at end of file diff --git a/build_index.rb b/build_index.rb deleted file mode 100644 index aae1268..0000000 --- a/build_index.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/main-pages") do |post_filename| - if post_filename.include?("index.md") - output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{post_filename}")).to_html) - end - end - return output -end - -template = ERB.new(File.read('template.html.erb')) -puts template.result(binding) \ No newline at end of file diff --git a/build_posts.rb b/build_posts.rb deleted file mode 100644 index ec03b77..0000000 --- a/build_posts.rb +++ /dev/null @@ -1,38 +0,0 @@ -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 \ No newline at end of file diff --git a/build_recipe_directory.rb b/build_recipe_directory.rb deleted file mode 100644 index de61f4f..0000000 --- a/build_recipe_directory.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/main-pages") do |post_filename| - if post_filename.include?("recipes.md") - output.concat(Kramdown::Document.new(File.read("./content/main-pages/#{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/footer.html.erb b/footer.html.erb deleted file mode 100644 index 1853f01..0000000 --- a/footer.html.erb +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/head.html.erb b/head.html.erb deleted file mode 100644 index 54a1636..0000000 --- a/head.html.erb +++ /dev/null @@ -1,5 +0,0 @@ - - Pantry of Plants - - - diff --git a/header.html.erb b/header.html.erb deleted file mode 100644 index efe40c9..0000000 --- a/header.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- -
diff --git a/partials/footer.html.erb b/partials/footer.html.erb new file mode 100644 index 0000000..1853f01 --- /dev/null +++ b/partials/footer.html.erb @@ -0,0 +1,4 @@ + diff --git a/partials/head.html.erb b/partials/head.html.erb new file mode 100644 index 0000000..54a1636 --- /dev/null +++ b/partials/head.html.erb @@ -0,0 +1,5 @@ + + Pantry of Plants + + + diff --git a/partials/header.html.erb b/partials/header.html.erb new file mode 100644 index 0000000..efe40c9 --- /dev/null +++ b/partials/header.html.erb @@ -0,0 +1,9 @@ +
+ +
diff --git a/recipe-directory-template.html.erb b/recipe-directory-template.html.erb index bbfe4dc..cd5c58a 100644 --- a/recipe-directory-template.html.erb +++ b/recipe-directory-template.html.erb @@ -1,11 +1,11 @@ - <%= render "head.html.erb" %> + <%= render "partials/head.html.erb" %> - <%= render "header.html.erb" %> + <%= render "partials/header.html.erb" %>
<%= content %>
- <%= render "footer.html.erb" %> + <%= render "partials/footer.html.erb" %> diff --git a/recipe-template.html.erb b/recipe-template.html.erb index 9c24d50..caa7b55 100644 --- a/recipe-template.html.erb +++ b/recipe-template.html.erb @@ -1,11 +1,11 @@ - <%= render "head.html.erb" %> + <%= render "partials/head.html.erb" %> - <%= render "header.html.erb" %> + <%= render "partials/header.html.erb" %>
<%= @content %>
- <%= render "footer.html.erb" %> + <%= render "partials/footer.html.erb" %> diff --git a/template.html.erb b/template.html.erb index 62b7a15..52d7041 100644 --- a/template.html.erb +++ b/template.html.erb @@ -1,9 +1,9 @@ - <%= render "head.html.erb" %> + <%= render "partials/head.html.erb" %> - <%= render "header.html.erb" %> + <%= render "partials/header.html.erb" %> <%= content %> - <%= render "footer.html.erb" %> + <%= render "partials/footer.html.erb" %> -- cgit v1.2.3