Class: Cadenza::TextRenderer
- Inherits:
-
BaseRenderer
- Object
- BaseRenderer
- Cadenza::TextRenderer
- Defined in:
- lib/cadenza/text_renderer.rb
Overview
The TextRenderer is the standard rendering logic for Cadenza. It will render an AST according to the rules specified in the Cadenza manual. See the manual for details.
Instance Attribute Summary
Attributes inherited from BaseRenderer
Class Method Summary collapse
-
.render(document_node, context) ⇒ Object
Renders the document given with the given context directly to a string returns.
Instance Method Summary collapse
Methods inherited from BaseRenderer
Constructor Details
This class inherits a constructor from Cadenza::BaseRenderer
Class Method Details
.render(document_node, context) ⇒ Object
Renders the document given with the given context directly to a string returns.
13 14 15 16 17 |
# File 'lib/cadenza/text_renderer.rb', line 13 def self.render(document_node, context) io = StringIO.new new(io).render(document_node, context) io.string end |
Instance Method Details
#render(node, context, blocks = {}) ⇒ Object
19 20 21 22 23 |
# File 'lib/cadenza/text_renderer.rb', line 19 def render(node, context, blocks={}) passed_blocks = blocks.is_a?(BlockHierarchy) ? blocks : BlockHierarchy.new(blocks) super(node, context, passed_blocks) end |