class Tilt::PandocTemplate

Pandoc markdown implementation. See: pandoc.org/

Public Instance Methods

allows_script?() click to toggle source
   # File lib/tilt/pandoc.rb
45 def allows_script?
46   false
47 end
evaluate(scope, locals, &block) click to toggle source
   # File lib/tilt/pandoc.rb
41 def evaluate(scope, locals, &block)
42   @output ||= @engine.to_html.strip
43 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
23 def pandoc_options
24   options.reduce([]) do |sum, (k,v)|
25     case v
26     when true
27       sum << (tilt_to_pandoc_mapping[k] || k)
28     when false
29       sum
30     else
31       sum << { k => v }
32     end
33   end
34 end
prepare() click to toggle source
   # File lib/tilt/pandoc.rb
36 def prepare
37   @engine = PandocRuby.new(data, *pandoc_options)
38   @output = nil
39 end
tilt_to_pandoc_mapping() click to toggle source
   # File lib/tilt/pandoc.rb
10 def tilt_to_pandoc_mapping
11   { :smartypants => :smart,
12     :escape_html => { :f => 'markdown-raw_html' },
13     :commonmark => { :f => 'commonmark' },
14     :markdown_strict => { :f => 'markdown_strict' }
15   }
16 end