Class: Tilt::RDiscountTemplate
- Defined in:
- lib/tilt/rdiscount.rb
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.
Constant Summary collapse
- ALIAS =
{ :escape_html => :filter_html, :smartypants => :smart }
- FLAGS =
[:smart, :filter_html, :smartypants, :escape_html]
Instance Attribute Summary
Attributes inherited from Template
#compiled_path, #data, #file, #line, #options
Instance Method Summary collapse
- #allows_script? ⇒ Boolean
- #evaluate(scope, locals, &block) ⇒ Object
- #flags ⇒ Object
- #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
34 35 36 |
# File 'lib/tilt/rdiscount.rb', line 34 def allows_script? false end |
#evaluate(scope, locals, &block) ⇒ Object
30 31 32 |
# File 'lib/tilt/rdiscount.rb', line 30 def evaluate(scope, locals, &block) @output ||= @engine.to_html end |
#flags ⇒ Object
21 22 23 |
# File 'lib/tilt/rdiscount.rb', line 21 def flags FLAGS.select { |flag| [flag] }.map { |flag| ALIAS[flag] || flag } end |
#prepare ⇒ Object
25 26 27 28 |
# File 'lib/tilt/rdiscount.rb', line 25 def prepare @engine = RDiscount.new(data, *flags) @output = nil end |