Class: WriteDown::Model::Slide

Inherits:
Base
  • Object
show all
Defined in:
lib/write_down/model/slide.rb

Instance Attribute Summary

Attributes inherited from Base

#content, #created_at, #draft, #link_to

Instance Method Summary collapse

Methods inherited from Base

#converter, #initialize, #read_from_head

Constructor Details

This class inherits a constructor from WriteDown::Model::Base

Instance Method Details

#bodyObject



13
14
15
# File 'lib/write_down/model/slide.rb', line 13

def body
  PandocRuby.convert(@content, { f: :org, to: :html5}, 'no-highlight')
end

#buildObject



17
18
19
20
21
22
23
# File 'lib/write_down/model/slide.rb', line 17

def build
  output = Pathname.new(@target_file)
  output.dirname.mkpath
  final_content = render
  output.write(final_content)
  self
end

#renderObject



8
9
10
11
# File 'lib/write_down/model/slide.rb', line 8

def render
  template = File.expand_path('../../erb/slide.erb', __FILE__)
  html_string = ERB.new(File.read(template)).result(binding)
end