Pandoc markdown implementation. See: pandoc.org/
# File lib/tilt/pandoc.rb, line 45 def allows_script? false end
# File lib/tilt/pandoc.rb, line 41 def evaluate(scope, locals, &block) @output ||= @engine.to_html.strip end
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
# File lib/tilt/pandoc.rb, line 36 def prepare @engine = PandocRuby.new(data, *pandoc_options) @output = nil end
# 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