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
- #compile! ⇒ Object
- #evaluate(scope, locals, &block) ⇒ Object
- #flags ⇒ Object
- #initialize_engine ⇒ Object
Methods inherited from Template
#basename, #compile, #eval_file, #initialize, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#compile! ⇒ Object
408 409 410 |
# File 'lib/sinatra/tilt.rb', line 408 def compile! @engine = RDiscount.new(data, *flags) end |
#evaluate(scope, locals, &block) ⇒ Object
412 413 414 |
# File 'lib/sinatra/tilt.rb', line 412 def evaluate(scope, locals, &block) @engine.to_html end |
#flags ⇒ Object
400 401 402 |
# File 'lib/sinatra/tilt.rb', line 400 def flags [:smart, :filter_html].select { |flag| [flag] } end |
#initialize_engine ⇒ Object
404 405 406 |
# File 'lib/sinatra/tilt.rb', line 404 def initialize_engine require_template_library 'rdiscount' unless defined? ::RDiscount end |