summaryrefslogtreecommitdiff
path: root/build_blog.rb
blob: d0cc2935383f31f6fc473ebbabbedb89d2c66918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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-template.html.erb'))
puts template.result(binding)