Class: Suma::SchemaTemplate::Plain

Inherits:
Object
  • Object
show all
Defined in:
lib/suma/schema_template/plain.rb

Overview

Emits a plain AsciiDoc body for a single EXPRESS schema, producing both HTML and XML outputs via Metanorma.

Constant Summary collapse

EXTENSIONS =
"xml,html"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_id) ⇒ Plain

Returns a new instance of Plain.



12
13
14
# File 'lib/suma/schema_template/plain.rb', line 12

def initialize(schema_id)
  @schema_id = schema_id
end

Instance Attribute Details

#schema_idObject (readonly)

Returns the value of attribute schema_id.



10
11
12
# File 'lib/suma/schema_template/plain.rb', line 10

def schema_id
  @schema_id
end

Instance Method Details

#extensionsObject



16
17
18
# File 'lib/suma/schema_template/plain.rb', line 16

def extensions
  EXTENSIONS
end

#render(path_to_schema_yaml) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/suma/schema_template/plain.rb', line 20

def render(path_to_schema_yaml)
  <<~ADOC
    = #{schema_id}
    :lutaml-express-index: schemas; #{path_to_schema_yaml};
    :bare: true
    :mn-document-class: iso
    :mn-output-extensions: #{extensions}

    [lutaml_express_liquid,schemas,context]
    ----
    {% for schema in context.schemas %}

    [%unnumbered]
    == #{schema_id}

    [source%unnumbered]
    --
    {{ schema.formatted }}
    --
    {% endfor %}
    ----

  ADOC
end