class Tilt::PandocTemplate
Pandoc markdown implementation. See: pandoc.org/
Public Instance Methods
allows_script?()
click to toggle source
# File lib/tilt/pandoc.rb 53 def allows_script? 54 false 55 end
evaluate(scope, locals, &block)
click to toggle source
# File lib/tilt/pandoc.rb 49 def evaluate(scope, locals, &block) 50 @output ||= @engine.to_html.strip 51 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 15 def pandoc_options 16 result = [] 17 from = "markdown" 18 smart_extension = "-smart" 19 options.each do |k,v| 20 case k 21 when :smartypants 22 smart_extension = "+smart" if v 23 when :escape_html 24 from = "markdown-raw_html" if v 25 when :commonmark 26 from = "commonmark" if v 27 when :markdown_strict 28 from = "markdown_strict" if v 29 else 30 case v 31 when true 32 result << k 33 when false 34 # do nothing 35 else 36 result << { k => v } 37 end 38 end 39 end 40 result << { :f => from + smart_extension } 41 result 42 end
prepare()
click to toggle source
# File lib/tilt/pandoc.rb 44 def prepare 45 @engine = PandocRuby.new(data, *pandoc_options) 46 @output = nil 47 end