Class: Coradoc::Output::HtmlSpa

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

Overview

SPA (Single Page Application) HTML output processor

Generates modern Vue.js + Tailwind CSS HTML documents from CoreModel.

Examples:

Using the processor directly

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

Using through Output module

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

Class Method Summary collapse

Methods included from Html::FormatDetection

html_extension?

Class Method Details

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

Process documents to SPA 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 SPA HTML output



71
72
73
74
75
76
77
78
# File 'lib/coradoc/html/output.rb', line 71

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

.processor_idObject



59
60
61
# File 'lib/coradoc/html/output.rb', line 59

def processor_id
  :html_spa
end

.processor_match?(filename) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/coradoc/html/output.rb', line 63

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