Class: Tilt::RedcarpetTemplate
- Defined in:
- lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb
Overview
Upskirt Markdown implementation. See: github.com/tanoku/redcarpet
Supports both Redcarpet 1.x and 2.x
Defined Under Namespace
Classes: Redcarpet1, Redcarpet2
Instance Attribute Summary
Attributes inherited from Template
Class Method Summary collapse
Instance Method Summary collapse
- #allows_script? ⇒ Boolean
- #evaluate(scope, locals, &block) ⇒ Object
- #initialize_engine ⇒ Object
- #prepare ⇒ Object
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
51 52 53 |
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 51 def self.engine_initialized? defined? ::Redcarpet end |
Instance Method Details
#allows_script? ⇒ Boolean
68 69 70 |
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 68 def allows_script? false end |
#evaluate(scope, locals, &block) ⇒ Object
64 65 66 |
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 64 def evaluate(scope, locals, &block) @engine.evaluate(scope, locals, &block) end |
#initialize_engine ⇒ Object
55 56 57 |
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 55 def initialize_engine require_template_library 'redcarpet' end |
#prepare ⇒ Object
59 60 61 62 |
# File 'lib/vendor/tilt-1.4.1/lib/tilt/markdown.rb', line 59 def prepare klass = [Redcarpet2, Redcarpet1].detect { |e| e.engine_initialized? } @engine = klass.new(file, line, ) { data } end |