class Tilt::PandocTemplate

Pandoc markdown implementation. See: pandoc.org/

Public Instance Methods

allows_script?() click to toggle source
# File lib/tilt/pandoc.rb, line 53
def allows_script?
  false
end
evaluate(scope, locals, &block) click to toggle source
# File lib/tilt/pandoc.rb, line 49
def evaluate(scope, locals, &block)
  @output ||= @engine.to_html.strip
end
pandoc_options() click to toggle source

turn options hash into an array Map tilt options to pandoc options Replace hash keys with value true with symbol for key Remove hash keys with value false Leave other hash keys untouched

# File lib/tilt/pandoc.rb, line 15
def pandoc_options
  result = []
  from = "markdown"
  smart_extension = "-smart"
  options.each do |k,v|
    case k
    when :smartypants
      smart_extension = "+smart" if v
    when :escape_html
      from = "markdown-raw_html" if v
    when :commonmark
      from = "commonmark" if v
    when :markdown_strict
      from = "markdown_strict" if v
    else
      case v
      when true
        result << k
      when false
        # do nothing
      else
        result << { k => v }
      end
    end
  end
  result << { :f => from + smart_extension }
  result
end
prepare() click to toggle source
# File lib/tilt/pandoc.rb, line 44
def prepare
  @engine = PandocRuby.new(data, *pandoc_options)
  @output = nil
end