Class: Coradoc::Output::HtmlStatic

Inherits:
Object
  • Object
show all
Extended by:
Html::FormatDetection
Defined in:
lib/coradoc/html/output.rb

Overview

Static HTML output processor

Generates static HTML documents from CoreModel using the classic rendering approach without JavaScript frameworks.

Examples:

Using the processor directly

html = Coradoc::Output::HtmlStatic.processor_execute({ "doc.html" => document }, {})

Using through Output module

result = Coradoc::Output.process(document, format: :html_static)

Class Method Summary collapse

Methods included from Html::FormatDetection

html_extension?

Class Method Details

.processor_execute(input, options = {}) ⇒ Hash<String, String>

Process documents to static HTML

Parameters:

  • input (Hash<String, Object>)

    mapping of filenames to documents

  • options (Hash) (defaults to: {})

    processing options

Returns:

  • (Hash<String, String>)

    mapping of filenames to HTML output



34
35
36
37
38
39
40
41
# File 'lib/coradoc/html/output.rb', line 34

def processor_execute(input, options = {})
  result = {}
  input.each do |filename, document|
    html = Coradoc::Html::Static.convert(document, options)
    result[filename] = html
  end
  result
end

.processor_idObject



22
23
24
# File 'lib/coradoc/html/output.rb', line 22

def processor_id
  :html_static
end

.processor_match?(filename) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/coradoc/html/output.rb', line 26

def processor_match?(filename)
  html_extension?(filename)
end