Class: Docco::Parser::Renderer
- Inherits:
-
Kramdown::Converter::Html
- Object
- Kramdown::Converter::Html
- Docco::Parser::Renderer
- Defined in:
- lib/docco/parser.rb
Overview
Subclasses Kramdown’s HTML converter so we can capture each top-level child’s rendered HTML during a single top-down walk. Overriding only convert_root lets Kramdown drive the recursion normally (so @stack, @footnotes, @used_ids, etc. behave as designed); we just replace the root-level concatenation step with a per-child capture into a hash keyed by Kramdown element identity.
Instance Attribute Summary collapse
-
#per_element_html ⇒ Object
readonly
Returns the value of attribute per_element_html.
Instance Method Summary collapse
- #convert_root(el, indent) ⇒ Object
-
#initialize(root, options) ⇒ Renderer
constructor
A new instance of Renderer.
Constructor Details
Instance Attribute Details
#per_element_html ⇒ Object (readonly)
Returns the value of attribute per_element_html.
14 15 16 |
# File 'lib/docco/parser.rb', line 14 def per_element_html @per_element_html end |
Instance Method Details
#convert_root(el, indent) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/docco/parser.rb', line 21 def convert_root(el, indent) @stack.push(el) indent += @indent el.children.each do |child| @per_element_html[child] = send(@dispatcher[child.type], child, indent) end @stack.pop '' end |