class Tilt::PandocTemplate
Pandoc markdown implementation. See: pandoc.org/
Public Instance Methods
allows_script?()
click to toggle source
# File lib/tilt/pandoc.rb, line 45 def allows_script? false end
evaluate(scope, locals, &block)
click to toggle source
# File lib/tilt/pandoc.rb, line 41 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 23 def pandoc_options options.reduce([]) do |sum, (k,v)| case v when true sum << (tilt_to_pandoc_mapping[k] || k) when false sum else sum << { k => v } end end end
prepare()
click to toggle source
# File lib/tilt/pandoc.rb, line 36 def prepare @engine = PandocRuby.new(data, *pandoc_options) @output = nil end
tilt_to_pandoc_mapping()
click to toggle source
# File lib/tilt/pandoc.rb, line 10 def tilt_to_pandoc_mapping { :smartypants => :smart, :escape_html => { :f => 'markdown-raw_html' }, :commonmark => { :f => 'commonmark' }, :markdown_strict => { :f => 'markdown_strict' } } end