Class: Tilt::RDoc::Markdown
- Inherits:
-
Template
- Object
- Template
- Tilt::RDoc::Markdown
- Defined in:
- lib/tilt/rdoc/markdown.rb
Instance Attribute Summary collapse
-
#rdoc_options ⇒ Object
Returns the value of attribute rdoc_options.
Instance Method Summary collapse
-
#evaluate(scope, locals, &block) ⇒ Object
:nodoc:.
-
#prepare ⇒ Object
:nodoc:.
Instance Attribute Details
#rdoc_options ⇒ Object
Returns the value of attribute rdoc_options.
9 10 11 |
# File 'lib/tilt/rdoc/markdown.rb', line 9 def @rdoc_options end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tilt/rdoc/markdown.rb', line 22 def evaluate(scope, locals, &block) # :nodoc: formatter = if @engine.ancestors.include? ::RDoc::Markup::ToTableOfContents @engine.new else @engine.new(@rdoc_options, nil) end html = ::RDoc::Markdown.parse(data).accept(formatter) @output ||= if @engine.ancestors.include? ::RDoc::Markup::ToTableOfContents html.map do |t| "<li><a href='##{t.aref}'>#{t.plain_html}</a></li>" end.join else html end end |
#prepare ⇒ Object
:nodoc:
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tilt/rdoc/markdown.rb', line 11 def prepare # :nodoc: @engine = if .delete(:toc) ::RDoc::Markup::ToTableOfContents else ::RDoc::Markup::ToHtml end @rdoc_options = ::RDoc::Options.new @rdoc_options.pipe = .delete(:pipe) || false @output = nil end |