Class: Coradoc::Html::Static
- Inherits:
-
ConverterBase
- Object
- ConverterBase
- Coradoc::Html::Static
- Defined in:
- lib/coradoc/html/static.rb
Overview
Static HTML converter
Converts CoreModel documents to static HTML5 output. This converter produces traditional HTML with external or embedded CSS/JS.
Defined Under Namespace
Classes: Configuration
Instance Attribute Summary
Attributes inherited from ConverterBase
Class Method Summary collapse
-
.processor_execute(input, options = {}) ⇒ Hash
Output processor interface: execute the conversion.
-
.processor_id ⇒ Symbol
Output processor interface: unique identifier.
-
.processor_match?(filename) ⇒ Boolean
Output processor interface: check if this processor handles the file.
Instance Method Summary collapse
-
#convert ⇒ String
Convert document to static HTML.
Methods inherited from ConverterBase
convert, #converter_name, #initialize, #to_file, to_file
Constructor Details
This class inherits a constructor from Coradoc::Html::ConverterBase
Class Method Details
.processor_execute(input, options = {}) ⇒ Hash
Output processor interface: execute the conversion
284 285 286 287 288 289 290 |
# File 'lib/coradoc/html/static.rb', line 284 def self.processor_execute(input, = {}) # Handle hash input from converter pipeline document = input.is_a?(Hash) ? (input[:document] || input.values.first) : input html = convert(document, ) # Return in format expected by converter (hash with filename => content) { nil => html } end |
.processor_id ⇒ Symbol
Output processor interface: unique identifier
267 268 269 |
# File 'lib/coradoc/html/static.rb', line 267 def self.processor_id :html_static end |
.processor_match?(filename) ⇒ Boolean
Output processor interface: check if this processor handles the file
275 276 277 |
# File 'lib/coradoc/html/static.rb', line 275 def self.processor_match?(filename) filename.downcase.end_with?('.html', '.htm') end |
Instance Method Details
#convert ⇒ String
Convert document to static HTML
192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/coradoc/html/static.rb', line 192 def convert # Build options hash for ClassicRenderer = # Use ClassicRenderer to generate HTML renderer = Html::Theme::ClassicRenderer.new(@document, ) if @config. renderer.render else renderer.render_html5 end end |