Class: Tilt::RDiscountTemplate
Overview
Discount Markdown implementation. See: github.com/rtomayko/rdiscount
RDiscount is a simple text filter. It does not support scope
or locals
. The :smart
and :filter_html
options may be set true to enable those flags on the underlying RDiscount object.
Instance Attribute Summary
Attributes inherited from Template
Instance Method Summary collapse
- #evaluate(scope, locals, &block) ⇒ Object
- #flags ⇒ Object
- #initialize_engine ⇒ Object
- #prepare ⇒ Object
Methods inherited from Template
#basename, #eval_file, #initialize, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
640 641 642 |
# File 'lib/frank/tilt.rb', line 640 def evaluate(scope, locals, &block) @output ||= @engine.to_html end |
#flags ⇒ Object
626 627 628 |
# File 'lib/frank/tilt.rb', line 626 def flags [:smart, :filter_html].select { |flag| [flag] } end |
#initialize_engine ⇒ Object
630 631 632 633 |
# File 'lib/frank/tilt.rb', line 630 def initialize_engine return if defined? ::RDiscount require_template_library 'rdiscount' end |
#prepare ⇒ Object
635 636 637 638 |
# File 'lib/frank/tilt.rb', line 635 def prepare @engine = RDiscount.new(data, *flags) @output = nil end |