class Eyemask::Core::Converter

Public Class Methods

new(initiaizer_options={}) click to toggle source
# File lib/eyemask/core/converter.rb, line 8
def initialize(initiaizer_options={})
  @template = ::Liquid::Template.parse(template(initiaizer_options[:template]))
end

Public Instance Methods

convert(document) click to toggle source
# File lib/eyemask/core/converter.rb, line 12
def convert(document)
  @template.render(document, registers: document).strip
end

Private Instance Methods

template(template) click to toggle source
# File lib/eyemask/core/converter.rb, line 18
def template(template)
  case template
  when "markdown"
    File.open(template_file("markdown.md")).read
  when "princexml"
    File.open(template_file("princexml.html")).read
  when "slides"
    File.open(template_file("slides.html")).read
  else
    File.open(File.expand_path(template)).read
  end
end
template_file(filename) click to toggle source
# File lib/eyemask/core/converter.rb, line 31
def template_file(filename)
  File.join(File.dirname(File.expand_path(__FILE__)), "../../../templates/#{filename}")
end