Method: OakTree::Template::Post#initialize

Defined in:
lib/oaktree/template/post.rb

#initialize(spec, post) ⇒ Post

Returns a new instance of Post.



13
14
15
16
17
18
19
20
# File 'lib/oaktree/template/post.rb', line 13

def initialize spec, post
  @post = post
  @content = nil
  @spec = spec
  document = ::Kramdown::Document.new(@post.content)
  @content, warnings = ::OakTree::Kramdown::OakHtml.convert(document.root, :auto_id_prefix => @post.time.strftime('%Y_%m_%d_'))
  puts warnings unless warnings.empty?
end