Class: Suma::SchemaTemplate::Document
- Inherits:
-
Object
- Object
- Suma::SchemaTemplate::Document
- Defined in:
- lib/suma/schema_template/document.rb
Overview
Emits an AsciiDoc body with cross-reference anchors for every schema element so other documents can deep-link into the compiled HTML. Only XML is produced — the anchors only resolve against the XML output, not the HTML rendering.
Constant Summary collapse
- EXTENSIONS =
"xml"
Instance Attribute Summary collapse
-
#schema_id ⇒ Object
readonly
Returns the value of attribute schema_id.
Instance Method Summary collapse
- #extensions ⇒ Object
-
#initialize(schema_id) ⇒ Document
constructor
A new instance of Document.
- #render(path_to_schema_yaml) ⇒ Object
Constructor Details
#initialize(schema_id) ⇒ Document
Returns a new instance of Document.
14 15 16 |
# File 'lib/suma/schema_template/document.rb', line 14 def initialize(schema_id) @schema_id = schema_id end |
Instance Attribute Details
#schema_id ⇒ Object (readonly)
Returns the value of attribute schema_id.
12 13 14 |
# File 'lib/suma/schema_template/document.rb', line 12 def schema_id @schema_id end |
Instance Method Details
#extensions ⇒ Object
18 19 20 |
# File 'lib/suma/schema_template/document.rb', line 18 def extensions EXTENSIONS end |
#render(path_to_schema_yaml) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/suma/schema_template/document.rb', line 22 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 %} [[#{schema_id}]] [%unnumbered,type=express] == #{schema_id} #{rendered_anchors} [source%unnumbered] -- {{ schema.formatted }} -- {% endfor %} ---- ADOC end |