metanorma-document 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +3 -2
  3. data/Rakefile +30 -5
  4. data/frontend/dist/app.css +1 -0
  5. data/frontend/dist/app.iife.js +24 -0
  6. data/frontend/package-lock.json +7 -505
  7. data/frontend/tailwind.config.js +5 -0
  8. data/lib/metanorma/csa_document/root.rb +27 -0
  9. data/lib/metanorma/csa_document.rb +9 -0
  10. data/lib/metanorma/document/cli.rb +52 -0
  11. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_body.rb +14 -0
  12. data/lib/metanorma/document/components/inline/comma_element.rb +3 -0
  13. data/lib/metanorma/document/components/inline/enum_comma_element.rb +3 -0
  14. data/lib/metanorma/document/components/inline/eref_element.rb +4 -1
  15. data/lib/metanorma/document/components/inline/fmt_termsource_element.rb +4 -2
  16. data/lib/metanorma/document/components/inline/math_element.rb +13 -7
  17. data/lib/metanorma/document/components/inline/vocabulary.rb +4 -0
  18. data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +6 -1
  19. data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +3 -0
  20. data/lib/metanorma/document/components/reference_elements/callout.rb +3 -2
  21. data/lib/metanorma/document/components/tables/table_cell.rb +3 -0
  22. data/lib/metanorma/document/elements/input.rb +44 -0
  23. data/lib/metanorma/document/elements.rb +1 -0
  24. data/lib/metanorma/document/relaton/address.rb +5 -0
  25. data/lib/metanorma/document/relaton/affiliation.rb +3 -0
  26. data/lib/metanorma/document/relaton/bib_item_size.rb +8 -9
  27. data/lib/metanorma/document/relaton/bib_item_type.rb +3 -0
  28. data/lib/metanorma/document/relaton/bibliographic_date.rb +5 -0
  29. data/lib/metanorma/document/relaton/contact_method.rb +5 -0
  30. data/lib/metanorma/document/relaton/contribution_info.rb +6 -2
  31. data/lib/metanorma/document/relaton/contributor.rb +4 -0
  32. data/lib/metanorma/document/relaton/contributor_role.rb +3 -0
  33. data/lib/metanorma/document/relaton/copyright_association.rb +3 -0
  34. data/lib/metanorma/document/relaton/copyright_owner.rb +3 -0
  35. data/lib/metanorma/document/relaton/date_time.rb +3 -0
  36. data/lib/metanorma/document/relaton/document_identifier.rb +4 -0
  37. data/lib/metanorma/document/relaton/document_relation.rb +8 -0
  38. data/lib/metanorma/document/relaton/document_status.rb +4 -0
  39. data/lib/metanorma/document/relaton/formatted_address.rb +4 -0
  40. data/lib/metanorma/document/relaton/full_name.rb +14 -3
  41. data/lib/metanorma/document/relaton/keyword_type.rb +3 -0
  42. data/lib/metanorma/document/relaton/locality_stack.rb +6 -9
  43. data/lib/metanorma/document/relaton/localized_name.rb +8 -5
  44. data/lib/metanorma/document/relaton/logo_element.rb +5 -0
  45. data/lib/metanorma/document/relaton/medium_type.rb +5 -16
  46. data/lib/metanorma/document/relaton/org_identifier.rb +2 -0
  47. data/lib/metanorma/document/relaton/org_subdivision.rb +2 -0
  48. data/lib/metanorma/document/relaton/org_subdivision_identifier.rb +2 -0
  49. data/lib/metanorma/document/relaton/organization.rb +3 -0
  50. data/lib/metanorma/document/relaton/person.rb +7 -1
  51. data/lib/metanorma/document/relaton/person_identifier.rb +3 -0
  52. data/lib/metanorma/document/relaton/place_type.rb +5 -0
  53. data/lib/metanorma/document/relaton/region_element.rb +3 -9
  54. data/lib/metanorma/document/relaton/relaton_collection.rb +2 -0
  55. data/lib/metanorma/document/relaton/series_type.rb +7 -0
  56. data/lib/metanorma/document/relaton/typed_note.rb +4 -0
  57. data/lib/metanorma/document/relaton/typed_title_string.rb +4 -0
  58. data/lib/metanorma/document/relaton/typed_uri.rb +3 -8
  59. data/lib/metanorma/document/relaton/validity_type.rb +8 -10
  60. data/lib/metanorma/document/relaton/variant_full_name.rb +3 -0
  61. data/lib/metanorma/document/relaton/variant_org_name.rb +3 -0
  62. data/lib/metanorma/document/relaton/version_info.rb +5 -0
  63. data/lib/metanorma/document/relaton/vocab_id_type.rb +6 -12
  64. data/lib/metanorma/document/relaton.rb +0 -14
  65. data/lib/metanorma/document/version.rb +1 -1
  66. data/lib/metanorma/document.rb +1 -0
  67. data/lib/metanorma/html/base_renderer.rb +86 -234
  68. data/lib/metanorma/html/concerns/metadata_extraction.rb +61 -0
  69. data/lib/metanorma/html/concerns/presentation_validation.rb +61 -0
  70. data/lib/metanorma/html/concerns/svg_processing.rb +32 -0
  71. data/lib/metanorma/html/concerns/text_extraction.rb +93 -0
  72. data/lib/metanorma/html/concerns/toc_registry.rb +47 -0
  73. data/lib/metanorma/html/csa_renderer.rb +9 -0
  74. data/lib/metanorma/html/drops/figure_drop.rb +33 -10
  75. data/lib/metanorma/html/drops/sourcecode_drop.rb +3 -6
  76. data/lib/metanorma/html/flavor.rb +6 -1
  77. data/lib/metanorma/html/generator.rb +8 -1
  78. data/lib/metanorma/html/iso_renderer.rb +0 -142
  79. data/lib/metanorma/html/renderers/block_renderer.rb +10 -0
  80. data/lib/metanorma/html/renderers/element_order_traversal.rb +15 -1
  81. data/lib/metanorma/html/renderers/inline_renderer.rb +13 -75
  82. data/lib/metanorma/html/standard_renderer.rb +195 -35
  83. data/lib/metanorma/html.rb +1 -51
  84. data/lib/metanorma/iso_document/sections/iso_preface.rb +27 -13
  85. data/lib/metanorma/mirror/default_registry.rb +21 -0
  86. data/lib/metanorma/mirror/handlers/inline/catalog.rb +7 -12
  87. data/lib/metanorma/mirror/handlers/inline/rich_html_renderer.rb +2 -3
  88. data/lib/metanorma/mirror/handlers/sourcecode.rb +1 -1
  89. data/lib/metanorma/mirror/model/guide.rb +3 -2
  90. data/lib/metanorma/mirror/output/formats/inline_format.rb +64 -3
  91. data/lib/metanorma/mirror/output/pipeline.rb +1 -0
  92. data/lib/metanorma/mirror/output.rb +0 -2
  93. data/lib/metanorma/mirror/rewriter.rb +3 -1
  94. data/lib/metanorma/registers/setup.rb +10 -0
  95. data/lib/metanorma/standard_document/annotation_container.rb +2 -0
  96. data/lib/metanorma/standard_document/elements/input.rb +4 -25
  97. data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +12 -2
  98. data/lib/metanorma/standard_document/metadata/presentation_metadata.rb +107 -0
  99. data/lib/metanorma/standard_document/metadata/semantic_metadata.rb +18 -0
  100. data/lib/metanorma/standard_document/metadata/unitsml/amount_of_substance.rb +19 -0
  101. data/lib/metanorma/standard_document/metadata/unitsml/base_quantity.rb +34 -0
  102. data/lib/metanorma/standard_document/metadata/unitsml/dimension.rb +39 -0
  103. data/lib/metanorma/standard_document/metadata/unitsml/dimension_set.rb +19 -0
  104. data/lib/metanorma/standard_document/metadata/unitsml/electric_current.rb +19 -0
  105. data/lib/metanorma/standard_document/metadata/unitsml/enumerated_root_unit.rb +23 -0
  106. data/lib/metanorma/standard_document/metadata/unitsml/length.rb +19 -0
  107. data/lib/metanorma/standard_document/metadata/unitsml/luminous_intensity.rb +19 -0
  108. data/lib/metanorma/standard_document/metadata/unitsml/mass.rb +19 -0
  109. data/lib/metanorma/standard_document/metadata/unitsml/namespace.rb +17 -0
  110. data/lib/metanorma/standard_document/metadata/unitsml/plane_angle.rb +19 -0
  111. data/lib/metanorma/standard_document/metadata/unitsml/prefix.rb +30 -0
  112. data/lib/metanorma/standard_document/metadata/unitsml/prefix_name.rb +21 -0
  113. data/lib/metanorma/standard_document/metadata/unitsml/prefix_set.rb +19 -0
  114. data/lib/metanorma/standard_document/metadata/unitsml/prefix_symbol.rb +21 -0
  115. data/lib/metanorma/standard_document/metadata/unitsml/quantity.rb +28 -0
  116. data/lib/metanorma/standard_document/metadata/unitsml/quantity_name.rb +21 -0
  117. data/lib/metanorma/standard_document/metadata/unitsml/quantity_set.rb +19 -0
  118. data/lib/metanorma/standard_document/metadata/unitsml/root_units.rb +19 -0
  119. data/lib/metanorma/standard_document/metadata/unitsml/thermodynamic_temperature.rb +19 -0
  120. data/lib/metanorma/standard_document/metadata/unitsml/time.rb +19 -0
  121. data/lib/metanorma/standard_document/metadata/unitsml/unit.rb +32 -0
  122. data/lib/metanorma/standard_document/metadata/unitsml/unit_name.rb +21 -0
  123. data/lib/metanorma/standard_document/metadata/unitsml/unit_set.rb +19 -0
  124. data/lib/metanorma/standard_document/metadata/unitsml/unit_symbol.rb +36 -0
  125. data/lib/metanorma/standard_document/metadata/unitsml/unit_system.rb +23 -0
  126. data/lib/metanorma/standard_document/metadata/unitsml/unitsml_root.rb +28 -0
  127. data/lib/metanorma/standard_document/metadata/unitsml.rb +39 -0
  128. data/lib/metanorma/standard_document/metadata.rb +4 -0
  129. data/lib/metanorma/standard_document/sections/misc_container.rb +8 -6
  130. data/lib/metanorma/standard_document/sections/sections.rb +7 -0
  131. data/lib/metanorma/un_document/blocks/un_admonition_block.rb +86 -0
  132. data/lib/metanorma/un_document/blocks.rb +9 -0
  133. data/lib/metanorma/un_document/root.rb +8 -0
  134. data/lib/metanorma/un_document/sections/un_abstract_section.rb +48 -0
  135. data/lib/metanorma/un_document/sections/un_preface.rb +19 -2
  136. data/lib/metanorma/un_document/sections.rb +1 -0
  137. data/lib/metanorma/un_document/un_text_element.rb +116 -0
  138. data/lib/metanorma/un_document.rb +2 -0
  139. data/script/benchmark_render.rb +35 -0
  140. data/tasks/roundtrip_samples.rake +1 -1
  141. metadata +63 -45
  142. data/.rubocop_todo.yml +0 -220
  143. data/TODO.finalize/01-split-multi-class-files.md +0 -8
  144. data/TODO.finalize/02-remove-data-dist-iso-document-frontend.md +0 -6
  145. data/TODO.finalize/03-align-frontend-iife-and-gha-build.md +0 -11
  146. data/TODO.finalize/04-theme-per-flavor-config-driven.md +0 -9
  147. data/TODO.finalize/05-migrate-all-html-to-liquid.md +0 -16
  148. data/TODO.finalize/06-integrate-pubid-library.md +0 -16
  149. data/TODO.finalize/07-replace-relaton-models-with-relaton-bib.md +0 -39
  150. data/TODO.finalize/08-refactor-renderer-architecture.md +0 -25
  151. data/TODO.finalize/09-eliminate-code-smells.md +0 -14
  152. data/TODO.finalize/10-comprehensive-spec-coverage.md +0 -24
  153. data/TODO.finalize/11-config-driven-flavor-metadata.md +0 -20
  154. data/TODO.finalize/12-add-frozen-string-literal.md +0 -6
  155. data/TODO.finalize/13-extract-composition-from-god-class.md +0 -96
  156. data/TODO.finalize/14-config-driven-section-ordering.md +0 -31
  157. data/TODO.finalize/15-theme-directories-per-flavor.md +0 -46
  158. data/TODO.finalize/16-theme-lutaml-model-schema.md +0 -44
  159. data/docs/html-renderer.adoc +0 -261
  160. data/lib/data/dist/iso_document/frontend/assets/index-mwzbzmnK.js +0 -22
  161. data/lib/data/dist/iso_document/frontend/assets/index-pGvKTNid.css +0 -1
  162. data/lib/data/dist/iso_document/frontend/assets/iso-red.svg +0 -53
  163. data/lib/data/dist/iso_document/frontend/index.html +0 -13
  164. data/lib/metanorma/document/relaton/bib_item_size_type.rb +0 -21
  165. data/lib/metanorma/document/relaton/bibliographic_date_type.rb +0 -22
  166. data/lib/metanorma/document/relaton/document_relation_type.rb +0 -31
  167. data/lib/metanorma/document/relaton/iso4217_code.rb +0 -17
  168. data/lib/metanorma/document/relaton/iso8601_date.rb +0 -17
  169. data/lib/metanorma/document/relaton/personal_identifier_type.rb +0 -21
  170. data/lib/metanorma/document/relaton/region_type.rb +0 -20
  171. data/lib/metanorma/document/relaton/series_type_type.rb +0 -21
  172. data/lib/metanorma/document/relaton/specific_locality_type.rb +0 -25
  173. data/lib/metanorma/document/relaton/title_type.rb +0 -21
  174. data/lib/metanorma/mirror/output/html_renderer.rb +0 -95
  175. data/lib/metanorma/mirror/output/html_renderers/block_renderers.rb +0 -178
  176. data/lib/metanorma/mirror/output/html_renderers/inline_renderer.rb +0 -61
  177. data/lib/metanorma/mirror/output/html_renderers/list_renderers.rb +0 -96
  178. data/lib/metanorma/mirror/output/html_renderers/mark_renderers.rb +0 -41
  179. data/lib/metanorma/mirror/output/html_renderers/section_renderers.rb +0 -129
  180. data/lib/metanorma/mirror/output/html_renderers/structural_renderers.rb +0 -80
  181. data/lib/metanorma/mirror/output/html_renderers/table_renderers.rb +0 -87
  182. data/lib/metanorma/mirror/output/html_renderers.rb +0 -76
  183. data/lib/metanorma/standard_document/annotation.rb +0 -37
@@ -3,31 +3,10 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  module Elements
6
- # Indication of text added through editorial intervention.
7
- class Input < Metanorma::StandardDocument::Elements::FormInput
8
- attribute :type, :string
9
- attribute :checked, :boolean
10
- attribute :disabled, :boolean
11
- attribute :readonly, :boolean
12
- attribute :maxlength, :integer
13
- attribute :minlength, :integer
14
-
15
- attribute :semx_id, :string
16
- attribute :original_id, :string
17
-
18
- xml do
19
- element "input"
20
- map_attribute "type", to: :type
21
- map_attribute "checked", to: :checked
22
- map_attribute "disabled", to: :disabled
23
- map_attribute "readonly", to: :readonly
24
- map_attribute "maxlength", to: :maxlength
25
- map_attribute "minlength", to: :minlength
26
-
27
- map_attribute "semx-id", to: :semx_id
28
- map_attribute "original-id", to: :original_id
29
- end
30
- end
6
+ # Kept as the StandardDocument-layer alias of the document-layer
7
+ # Input model (see lib/metanorma/document/elements/input.rb) so
8
+ # existing StandardDocument references keep working.
9
+ Input = Metanorma::Document::Elements::Input
31
10
  end
32
11
  end
33
12
  end
@@ -3,12 +3,22 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  module Metadata
6
+ # <metanorma-extension> holds processor-generated metadata.
7
+ # Children, when present, appear in this fixed order:
8
+ # semantic-metadata, presentation-metadata, UnitsML,
9
+ # source-highlighter-css.
6
10
  class MetanormaExtension < Lutaml::Model::Serializable
7
- attribute :content, :string
11
+ attribute :semantic_metadata, SemanticMetadata
12
+ attribute :presentation_metadata, PresentationMetadata
13
+ attribute :unitsml, Unitsml::UnitsmlRoot
14
+ attribute :source_highlighter_css, :string
8
15
 
9
16
  xml do
10
17
  element "metanorma-extension"
11
- map_all_content to: :content
18
+ map_element "semantic-metadata", to: :semantic_metadata
19
+ map_element "presentation-metadata", to: :presentation_metadata
20
+ map_element "UnitsML", to: :unitsml
21
+ map_element "source-highlighter-css", to: :source_highlighter_css
12
22
  end
13
23
  end
14
24
  end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ # <presentation-metadata> carries rendering hints for the document.
7
+ #
8
+ # Current serialization uses typed children (toc-heading-levels,
9
+ # document-scheme, the OGC color-* family, OIML doctype-alias/fonts,
10
+ # isodoc html-details-open). The legacy serialization (still emitted
11
+ # into misc-container by some flavors) uses <name>/<value> pairs
12
+ # instead. Both shapes are mapped here so either round-trips
13
+ # losslessly. map_element order matches the order emitted by
14
+ # metanorma across spec fixtures.
15
+ class PresentationMetadata < Lutaml::Model::Serializable
16
+ attribute :doctype_alias, :string
17
+ attribute :document_scheme, :string
18
+ attribute :color_admonition_caution, :string
19
+ attribute :color_admonition_editor, :string
20
+ attribute :color_admonition_important, :string
21
+ attribute :color_admonition_note, :string
22
+ attribute :color_admonition_safety_precaution, :string
23
+ attribute :color_admonition_tip, :string
24
+ attribute :color_admonition_todo, :string
25
+ attribute :color_admonition_warning, :string
26
+ attribute :color_background_definition_description, :string
27
+ attribute :color_background_definition_term, :string
28
+ attribute :color_background_page, :string
29
+ attribute :color_background_table_header, :string
30
+ attribute :color_background_table_row_even, :string
31
+ attribute :color_background_table_row_odd, :string
32
+ attribute :color_background_term_admitted_label, :string
33
+ attribute :color_background_term_deprecated_label, :string
34
+ attribute :color_background_term_preferred_label, :string
35
+ attribute :color_background_text_label_legacy, :string
36
+ attribute :color_secondary_shade1, :string
37
+ attribute :color_secondary_shade2, :string
38
+ attribute :color_text, :string
39
+ attribute :color_text_title, :string
40
+ attribute :toc_heading_levels, :string
41
+ attribute :html_toc_heading_levels, :string
42
+ attribute :doc_toc_heading_levels, :string
43
+ attribute :pdf_toc_heading_levels, :string
44
+ attribute :html_details_open, :string
45
+ attribute :fonts, :string, collection: true
46
+ attribute :name, :string
47
+ attribute :value, :string
48
+
49
+ xml do
50
+ element "presentation-metadata"
51
+ map_element "doctype-alias", to: :doctype_alias
52
+ map_element "document-scheme", to: :document_scheme
53
+ map_element "color-admonition-caution",
54
+ to: :color_admonition_caution
55
+ map_element "color-admonition-editor",
56
+ to: :color_admonition_editor
57
+ map_element "color-admonition-important",
58
+ to: :color_admonition_important
59
+ map_element "color-admonition-note",
60
+ to: :color_admonition_note
61
+ map_element "color-admonition-safety-precaution",
62
+ to: :color_admonition_safety_precaution
63
+ map_element "color-admonition-tip",
64
+ to: :color_admonition_tip
65
+ map_element "color-admonition-todo",
66
+ to: :color_admonition_todo
67
+ map_element "color-admonition-warning",
68
+ to: :color_admonition_warning
69
+ map_element "color-background-definition-description",
70
+ to: :color_background_definition_description
71
+ map_element "color-background-definition-term",
72
+ to: :color_background_definition_term
73
+ map_element "color-background-page",
74
+ to: :color_background_page
75
+ map_element "color-background-table-header",
76
+ to: :color_background_table_header
77
+ map_element "color-background-table-row-even",
78
+ to: :color_background_table_row_even
79
+ map_element "color-background-table-row-odd",
80
+ to: :color_background_table_row_odd
81
+ map_element "color-background-term-admitted-label",
82
+ to: :color_background_term_admitted_label
83
+ map_element "color-background-term-deprecated-label",
84
+ to: :color_background_term_deprecated_label
85
+ map_element "color-background-term-preferred-label",
86
+ to: :color_background_term_preferred_label
87
+ map_element "color-background-text-label-legacy",
88
+ to: :color_background_text_label_legacy
89
+ map_element "color-secondary-shade-1",
90
+ to: :color_secondary_shade1
91
+ map_element "color-secondary-shade-2",
92
+ to: :color_secondary_shade2
93
+ map_element "color-text", to: :color_text
94
+ map_element "color-text-title", to: :color_text_title
95
+ map_element "toc-heading-levels", to: :toc_heading_levels
96
+ map_element "html-toc-heading-levels", to: :html_toc_heading_levels
97
+ map_element "doc-toc-heading-levels", to: :doc_toc_heading_levels
98
+ map_element "pdf-toc-heading-levels", to: :pdf_toc_heading_levels
99
+ map_element "html-details-open", to: :html_details_open
100
+ map_element "fonts", to: :fonts
101
+ map_element "name", to: :name
102
+ map_element "value", to: :value
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ # <semantic-metadata> carries semantic flags about the document
7
+ # (only <stage-published> has been observed in the wild).
8
+ class SemanticMetadata < Lutaml::Model::Serializable
9
+ attribute :stage_published, :string
10
+
11
+ xml do
12
+ element "semantic-metadata"
13
+ map_element "stage-published", to: :stage_published
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class AmountOfSubstance < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "AmountOfSubstance"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ # Shared attributes for the eight UnitsML base-quantity elements
8
+ # (Length, Mass, Time, ElectricCurrent, AmountOfSubstance,
9
+ # ThermodynamicTemperature, LuminousIntensity, PlaneAngle).
10
+ module BaseQuantityAttributes
11
+ def self.included(base)
12
+ base.class_eval do
13
+ attribute :symbol, :string
14
+ attribute :power_numerator, :integer
15
+ attribute :power_denominator, :integer
16
+ end
17
+ end
18
+ end
19
+
20
+ # Shared attribute mappings for the base-quantity elements.
21
+ # lutaml-model does not inherit xml mappings, so each per-tag class
22
+ # applies this inside its own `xml do` block (same pattern as
23
+ # StandardDocument::RootXmlMapping).
24
+ module BaseQuantityXmlMapping
25
+ def self.apply(mapping)
26
+ mapping.map_attribute "symbol", to: :symbol
27
+ mapping.map_attribute "powerNumerator", to: :power_numerator
28
+ mapping.map_attribute "powerDenominator", to: :power_denominator
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class Dimension < Lutaml::Model::Serializable
8
+ attribute :id, :string
9
+ attribute :semx_id, :string
10
+
11
+ attribute :length, Length
12
+ attribute :mass, Mass
13
+ attribute :time, Time
14
+ attribute :electric_current, ElectricCurrent
15
+ attribute :thermodynamic_temperature, ThermodynamicTemperature
16
+ attribute :amount_of_substance, AmountOfSubstance
17
+ attribute :luminous_intensity, LuminousIntensity
18
+ attribute :plane_angle, PlaneAngle
19
+
20
+ xml do
21
+ element "Dimension"
22
+ namespace Unitsml::Namespace
23
+ map_attribute "id", to: :id
24
+ map_attribute "semx-id", to: :semx_id
25
+ map_element "Length", to: :length
26
+ map_element "Mass", to: :mass
27
+ map_element "Time", to: :time
28
+ map_element "ElectricCurrent", to: :electric_current
29
+ map_element "ThermodynamicTemperature",
30
+ to: :thermodynamic_temperature
31
+ map_element "AmountOfSubstance", to: :amount_of_substance
32
+ map_element "LuminousIntensity", to: :luminous_intensity
33
+ map_element "PlaneAngle", to: :plane_angle
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class DimensionSet < Lutaml::Model::Serializable
8
+ attribute :dimension, Dimension, collection: true
9
+
10
+ xml do
11
+ element "DimensionSet"
12
+ namespace Unitsml::Namespace
13
+ map_element "Dimension", to: :dimension
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class ElectricCurrent < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "ElectricCurrent"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class EnumeratedRootUnit < Lutaml::Model::Serializable
8
+ attribute :unit, :string
9
+ attribute :prefix, :string
10
+ attribute :power_numerator, :integer
11
+
12
+ xml do
13
+ element "EnumeratedRootUnit"
14
+ namespace Unitsml::Namespace
15
+ map_attribute "unit", to: :unit
16
+ map_attribute "prefix", to: :prefix
17
+ map_attribute "powerNumerator", to: :power_numerator
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class Length < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "Length"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class LuminousIntensity < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "LuminousIntensity"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class Mass < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "Mass"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ # UnitsML vocabulary namespace. Fixtures use the default-namespace
8
+ # form (<UnitsML xmlns="..."> with unprefixed children), so no
9
+ # prefix_default is declared.
10
+ class Namespace < Lutaml::Xml::Namespace
11
+ uri "https://schema.unitsml.org/unitsml/1.0"
12
+ element_form_default :qualified
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class PlaneAngle < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "PlaneAngle"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class Prefix < Lutaml::Model::Serializable
8
+ attribute :prefix_base, :integer
9
+ attribute :prefix_power, :integer
10
+ attribute :id, :string
11
+ attribute :semx_id, :string
12
+
13
+ attribute :prefix_name, PrefixName
14
+ attribute :prefix_symbol, PrefixSymbol, collection: true
15
+
16
+ xml do
17
+ element "Prefix"
18
+ namespace Unitsml::Namespace
19
+ map_attribute "prefixBase", to: :prefix_base
20
+ map_attribute "prefixPower", to: :prefix_power
21
+ map_attribute "id", to: :id
22
+ map_attribute "semx-id", to: :semx_id
23
+ map_element "PrefixName", to: :prefix_name
24
+ map_element "PrefixSymbol", to: :prefix_symbol
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class PrefixName < Lutaml::Model::Serializable
8
+ attribute :lang, :string
9
+ attribute :text, :string
10
+
11
+ xml do
12
+ element "PrefixName"
13
+ namespace Unitsml::Namespace
14
+ map_attribute "lang", to: :lang
15
+ map_content to: :text
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class PrefixSet < Lutaml::Model::Serializable
8
+ attribute :prefix, Prefix, collection: true
9
+
10
+ xml do
11
+ element "PrefixSet"
12
+ namespace Unitsml::Namespace
13
+ map_element "Prefix", to: :prefix
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class PrefixSymbol < Lutaml::Model::Serializable
8
+ attribute :type, :string
9
+ attribute :text, :string
10
+
11
+ xml do
12
+ element "PrefixSymbol"
13
+ namespace Unitsml::Namespace
14
+ map_attribute "type", to: :type
15
+ map_content to: :text
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class Quantity < Lutaml::Model::Serializable
8
+ attribute :id, :string
9
+ attribute :quantity_type, :string
10
+ attribute :dimension_url, :string
11
+ attribute :semx_id, :string
12
+
13
+ attribute :quantity_name, QuantityName, collection: true
14
+
15
+ xml do
16
+ element "Quantity"
17
+ namespace Unitsml::Namespace
18
+ map_attribute "id", to: :id
19
+ map_attribute "quantityType", to: :quantity_type
20
+ map_attribute "dimensionURL", to: :dimension_url
21
+ map_attribute "semx-id", to: :semx_id
22
+ map_element "QuantityName", to: :quantity_name
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class QuantityName < Lutaml::Model::Serializable
8
+ attribute :lang, :string
9
+ attribute :text, :string
10
+
11
+ xml do
12
+ element "QuantityName"
13
+ namespace Unitsml::Namespace
14
+ map_attribute "lang", to: :lang
15
+ map_content to: :text
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class QuantitySet < Lutaml::Model::Serializable
8
+ attribute :quantity, Quantity, collection: true
9
+
10
+ xml do
11
+ element "QuantitySet"
12
+ namespace Unitsml::Namespace
13
+ map_element "Quantity", to: :quantity
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class RootUnits < Lutaml::Model::Serializable
8
+ attribute :enumerated_root_unit, EnumeratedRootUnit, collection: true
9
+
10
+ xml do
11
+ element "RootUnits"
12
+ namespace Unitsml::Namespace
13
+ map_element "EnumeratedRootUnit", to: :enumerated_root_unit
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Metadata
6
+ module Unitsml
7
+ class ThermodynamicTemperature < Lutaml::Model::Serializable
8
+ include BaseQuantityAttributes
9
+
10
+ xml do
11
+ element "ThermodynamicTemperature"
12
+ namespace Unitsml::Namespace
13
+ BaseQuantityXmlMapping.apply(self)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end