Class: Tilt::PandocTemplate
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb
Overview
Pandoc markdown implementation. See: pandoc.org/
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Template
Instance Method Summary collapse
- #allows_script? ⇒ Boolean
- #evaluate(scope, locals, &block) ⇒ Object
-
#pandoc_options ⇒ Object
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.
- #prepare ⇒ Object
Methods inherited from Template
#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#allows_script? ⇒ Boolean
53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb', line 53 def allows_script? false end |
#evaluate(scope, locals, &block) ⇒ Object
49 50 51 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb', line 49 def evaluate(scope, locals, &block) @output ||= @engine.to_html.strip end |
#pandoc_options ⇒ Object
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
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb', line 15 def result = [] from = "markdown" smart_extension = "-smart" .each do |k,v| case k when :smartypants smart_extension = "+smart" if v when :escape_html from = "markdown-raw_html" if v when :commonmark from = "commonmark" if v when :markdown_strict from = "markdown_strict" if v else case v when true result << k when false # do nothing else result << { k => v } end end end result << { :f => from + smart_extension } result end |
#prepare ⇒ Object
44 45 46 47 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/pandoc.rb', line 44 def prepare @engine = PandocRuby.new(data, *) @output = nil end |