Class: MMMD::Renderers::HTML
- Inherits:
-
Object
- Object
- MMMD::Renderers::HTML
- Defined in:
- lib/mmmd/renderers/html.rb
Overview
HTML Renderer
Instance Method Summary collapse
-
#initialize(dom, options) ⇒ HTML
constructor
A new instance of HTML.
-
#render ⇒ Object
Render document to HTML.
Constructor Details
#initialize(dom, options) ⇒ HTML
Returns a new instance of HTML.
138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/mmmd/renderers/html.rb', line 138 def initialize(dom, ) @document = dom @options = @options["linewrap"] ||= 80 @options["init_level"] ||= 2 @options["indent"] ||= 2 mapmanager = HTMLConstants::MapManager.new() @mapping = mapmanager.mapping return unless @options["nowrap"] @options["init_level"] = 0 @mapping.delete("PointBlank::DOM::Document") end |
Instance Method Details
#render ⇒ Object
Render document to HTML
153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/mmmd/renderers/html.rb', line 153 def render text = _render(@document, @options, level: @options["init_level"]) @options["init_level"].times { text = indent(text) } if @options["nowrap"] text else [ preambule, remove_pre_spaces(text), postambule ].join("\n") end end |