Class: Tilt::RDiscountTemplate
- Inherits:
-
Template
show all
- Defined in:
- lib/vendor/tilt-1.4.1/lib/tilt/markdown.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
#data, #file, #line, #options
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Template
#basename, #default_encoding, #eval_file, #initialize, #name, #read_template_file, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Class Method Details
.engine_initialized? ⇒ Boolean
24
25
26
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 24
def self.engine_initialized?
defined? ::RDiscount
end
|
Instance Method Details
#allows_script? ⇒ Boolean
41
42
43
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 41
def allows_script?
false
end
|
#evaluate(scope, locals, &block) ⇒ Object
37
38
39
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 37
def evaluate(scope, locals, &block)
@output ||= @engine.to_html
end
|
20
21
22
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 20
def flags
FLAGS.select { |flag| options[flag] }.map { |flag| ALIAS[flag] || flag }
end
|
#initialize_engine ⇒ Object
28
29
30
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 28
def initialize_engine
require_template_library 'rdiscount'
end
|
32
33
34
35
|
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 32
def prepare
@engine = RDiscount.new(data, *flags)
@output = nil
end
|