Class: Coradoc::Html::Transform::FromCoreModel

Inherits:
Object
  • Object
show all
Defined in:
lib/coradoc/html/transform/from_core_model.rb

Overview

Transforms CoreModel to HTML output

This transformer converts CoreModel to HTML strings by delegating to the existing theme/renderer pipeline.

Class Method Summary collapse

Class Method Details

.transform(model, options = {}) ⇒ String

Transform a CoreModel to HTML string

Parameters:

  • model (Coradoc::CoreModel::Base, Array)

    CoreModel to transform

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

    Renderer options (e.g., theme)

Returns:

  • (String)

    HTML output



19
20
21
22
23
24
25
26
27
28
# File 'lib/coradoc/html/transform/from_core_model.rb', line 19

def transform(model, options = {})
  case model
  when Coradoc::CoreModel::Base
    Html.serialize(model, options)
  when Array
    model.map { |item| transform(item, options) }.join("\n")
  else
    model.to_s
  end
end