diff options
author | scottj <jones.scott0391@gmail.com> | 2021-08-21 13:01:57 -0700 |
---|---|---|
committer | scottj <jones.scott0391@gmail.com> | 2021-08-21 13:01:57 -0700 |
commit | c3011d75e8abd6c4665dc94447f7a6b5df3ca49a (patch) | |
tree | 5fe8df1826d14e27945356827d03f34d3a26a87c /build-files | |
parent | ae664f319da06da2951ed311eadd33b7c891c648 (diff) |
cleaned up file organization
Diffstat (limited to 'build-files')
-rw-r--r-- | build-files/build_about.rb | 19 | ||||
-rw-r--r-- | build-files/build_index.rb | 19 | ||||
-rw-r--r-- | build-files/build_posts.rb | 38 | ||||
-rw-r--r-- | build-files/build_recipe_directory.rb | 19 |
4 files changed, 95 insertions, 0 deletions
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) |