Class: Tilt::Redcarpet2Template
- Inherits:
-
Template
show all
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb
Overview
Future proof mode for Redcarpet 2.x (not yet released)
Instance Attribute Summary
Attributes inherited from Template
#data, #file, #line, #options
Instance Method Summary
collapse
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
72
73
74
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb', line 72
def allows_script?
false
end
|
#evaluate(scope, locals, &block) ⇒ Object
68
69
70
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb', line 68
def evaluate(scope, locals, &block)
@output ||= @engine.render(data)
end
|
#generate_renderer ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb', line 38
def generate_renderer
renderer = options.delete(:renderer) || ::Redcarpet::Render::HTML.new(options)
return renderer unless options.delete(:smartypants)
return renderer if renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants
if renderer == ::Redcarpet::Render::XHTML
::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
elsif renderer == ::Redcarpet::Render::HTML
::Redcarpet::Render::SmartyHTML
elsif renderer.is_a? Class
Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
else
renderer.extend ::Redcarpet::Render::SmartyPants
end
end
|
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tilt-2.0.11/lib/tilt/redcarpet.rb', line 54
def prepare
Redcarpet1Template::ALIAS.each do |opt, aka|
next if options.key? opt or not options.key? aka
options[opt] = options.delete(aka)
end
options.delete(:escape_html) unless options[:escape_html]
@engine = ::Redcarpet::Markdown.new(generate_renderer, options)
@output = nil
end
|