class Tilt::PandocTemplate

Pandoc markdown implementation. See: pandoc.org/

Public Instance Methods

allows_script?() click to toggle source
# File lib/tilt/pandoc.rb, line 49
def allows_script?
  false
end
evaluate(scope, locals, &block) click to toggle source
# File lib/tilt/pandoc.rb, line 45
def evaluate(scope, locals, &block)
  @output
end
options_array() click to toggle source
# File lib/tilt/pandoc.rb, line 30
def options_array
  pandoc_optimised_options.map do |option|
    option[0] if option[1] === true
  end.compact
end
options_hash() click to toggle source
# File lib/tilt/pandoc.rb, line 36
def options_hash
  pandoc_optimised_options.inject({}) do |hash, option|
    # next if option[1] === true
    # next if option[1] === false
    hash[option[0]] = option[1] unless option[1] === true or option[1] === false
    hash
  end
end
pandoc_optimised_options() click to toggle source
# File lib/tilt/pandoc.rb, line 18
def pandoc_optimised_options
  options.inject({}) do |hash, option|
    if tilt_to_pandoc_mapping.has_key?(option[0]) && option[1] === true
      hash[tilt_to_pandoc_mapping[option[0]][0]] = tilt_to_pandoc_mapping[option[0]][1]
    else
      hash[option[0]] = option[1]
    end

    hash
  end.merge({:to => :html})
end
prepare() click to toggle source
# File lib/tilt/pandoc.rb, line 8
def prepare
  @output = PandocRuby.convert(data, options_hash, *options_array).strip
end
tilt_to_pandoc_mapping() click to toggle source
# File lib/tilt/pandoc.rb, line 12
def tilt_to_pandoc_mapping
  { :smartypants => [:smart, true],
    :escape_html => [:f, 'markdown-raw_html']
  }
end