metanorma-document 0.2.6 → 0.2.8

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 (202) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +41 -168
  3. data/Gemfile +2 -0
  4. data/lib/metanorma/basic_document/ancillary_blocks/figure_block.rb +3 -1
  5. data/lib/metanorma/basic_document/blocks/basic_block.rb +5 -1
  6. data/lib/metanorma/basic_document/blocks/note_block.rb +5 -0
  7. data/lib/metanorma/basic_document/blocks.rb +3 -24
  8. data/lib/metanorma/basic_document/lists/list.rb +2 -1
  9. data/lib/metanorma/basic_document/lists/list_item.rb +17 -0
  10. data/lib/metanorma/basic_document/lists.rb +1 -0
  11. data/lib/metanorma/basic_document/paragraphs/paragraph_with_footnote.rb +3 -1
  12. data/lib/metanorma/basic_document/reference_elements/callout.rb +1 -1
  13. data/lib/metanorma/basic_document/reference_elements/footnote.rb +1 -1
  14. data/lib/metanorma/basic_document/text_elements/mathml.rb +1 -1
  15. data/lib/metanorma/bipm_document/root.rb +10 -50
  16. data/lib/metanorma/bipm_document.rb +0 -2
  17. data/lib/metanorma/bsi_document/metadata/bsi_bib_data_extension_type.rb +10 -0
  18. data/lib/metanorma/bsi_document/metadata/bsi_bibliographic_item.rb +15 -0
  19. data/lib/metanorma/bsi_document/metadata.rb +12 -0
  20. data/lib/metanorma/bsi_document/root.rb +29 -0
  21. data/lib/metanorma/bsi_document/sections/bsi_annex_section.rb +25 -0
  22. data/lib/metanorma/bsi_document/sections/bsi_clause_section.rb +25 -0
  23. data/lib/metanorma/bsi_document/sections/bsi_sections.rb +27 -0
  24. data/lib/metanorma/bsi_document/sections.rb +11 -0
  25. data/lib/metanorma/bsi_document.rb +11 -0
  26. data/lib/metanorma/cc_document/root.rb +10 -50
  27. data/lib/metanorma/cc_document.rb +0 -2
  28. data/lib/metanorma/collection.rb +0 -2
  29. data/lib/metanorma/document/components/ancillary_blocks/example_block.rb +3 -3
  30. data/lib/metanorma/document/components/ancillary_blocks/figure_block.rb +2 -0
  31. data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +2 -0
  32. data/lib/metanorma/document/components/blocks/passthrough.rb +21 -0
  33. data/lib/metanorma/document/components/blocks/requirement_model.rb +159 -0
  34. data/lib/metanorma/document/components/blocks.rb +10 -0
  35. data/lib/metanorma/document/components/contrib_metadata/contribution_element_metadata.rb +3 -1
  36. data/lib/metanorma/document/components/id_elements/image.rb +2 -0
  37. data/lib/metanorma/document/components/inline/xref_element.rb +8 -0
  38. data/lib/metanorma/document/components/lists/definition_list.rb +6 -0
  39. data/lib/metanorma/document/components/lists/list_item.rb +1 -1
  40. data/lib/metanorma/document/components/lists/ordered_list.rb +6 -0
  41. data/lib/metanorma/document/components/lists/unordered_list.rb +8 -0
  42. data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +8 -0
  43. data/lib/metanorma/document/components/multi_paragraph/review_block.rb +3 -0
  44. data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +6 -2
  45. data/lib/metanorma/document/components/reference_elements/source_element.rb +57 -0
  46. data/lib/metanorma/document/components/reference_elements.rb +6 -0
  47. data/lib/metanorma/document/components/sections/references_section.rb +1 -1
  48. data/lib/metanorma/document/components/tables/table_block.rb +10 -0
  49. data/lib/metanorma/document/components/tables/table_cell.rb +2 -1
  50. data/lib/metanorma/document/data_types.rb +0 -4
  51. data/lib/metanorma/document/elements/add.rb +18 -0
  52. data/lib/metanorma/document/elements/del.rb +18 -0
  53. data/lib/metanorma/document/elements.rb +10 -0
  54. data/lib/metanorma/document/relaton/address.rb +16 -0
  55. data/lib/metanorma/document/root.rb +1 -3
  56. data/lib/metanorma/document/version.rb +1 -1
  57. data/lib/metanorma/document.rb +11 -2
  58. data/lib/metanorma/gb_document/metadata/gb_bib_data_extension_type.rb +10 -0
  59. data/lib/metanorma/gb_document/metadata/gb_bibliographic_item.rb +15 -0
  60. data/lib/metanorma/gb_document/metadata.rb +12 -0
  61. data/lib/metanorma/gb_document/root.rb +29 -0
  62. data/lib/metanorma/gb_document.rb +10 -0
  63. data/lib/metanorma/generic_document/root.rb +31 -0
  64. data/lib/metanorma/generic_document.rb +7 -0
  65. data/lib/metanorma/html/base_renderer.rb +206 -120
  66. data/lib/metanorma/html/bipm_renderer.rb +16 -8
  67. data/lib/metanorma/html/cc_renderer.rb +0 -1
  68. data/lib/metanorma/html/component/base.rb +5 -1
  69. data/lib/metanorma/html/component/footnote_collector.rb +3 -3
  70. data/lib/metanorma/html/component/index_section.rb +27 -9
  71. data/lib/metanorma/html/component/index_term_collector.rb +8 -3
  72. data/lib/metanorma/html/component.rb +2 -1
  73. data/lib/metanorma/html/drops/figure_drop.rb +14 -5
  74. data/lib/metanorma/html/drops/formula_drop.rb +7 -2
  75. data/lib/metanorma/html/drops/sourcecode_drop.rb +6 -2
  76. data/lib/metanorma/html/drops.rb +2 -1
  77. data/lib/metanorma/html/generator.rb +16 -6
  78. data/lib/metanorma/html/iec_renderer.rb +0 -1
  79. data/lib/metanorma/html/ieee_renderer.rb +0 -1
  80. data/lib/metanorma/html/ietf_renderer.rb +0 -1
  81. data/lib/metanorma/html/iho_renderer.rb +1 -2
  82. data/lib/metanorma/html/iso_renderer.rb +68 -23
  83. data/lib/metanorma/html/itu_renderer.rb +0 -1
  84. data/lib/metanorma/html/ogc_renderer.rb +0 -1
  85. data/lib/metanorma/html/oiml_renderer.rb +0 -1
  86. data/lib/metanorma/html/pdfa_renderer.rb +0 -1
  87. data/lib/metanorma/html/ribose_renderer.rb +0 -1
  88. data/lib/metanorma/html/standard_renderer.rb +61 -28
  89. data/lib/metanorma/html/theme.rb +2 -2
  90. data/lib/metanorma/html.rb +48 -1
  91. data/lib/metanorma/iec_document/root.rb +8 -47
  92. data/lib/metanorma/iec_document.rb +2 -3
  93. data/lib/metanorma/ieee_document/root.rb +14 -50
  94. data/lib/metanorma/ieee_document/sections/ieee_sections.rb +31 -0
  95. data/lib/metanorma/ieee_document/sections.rb +9 -0
  96. data/lib/metanorma/ieee_document.rb +3 -3
  97. data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +0 -2
  98. data/lib/metanorma/ietf_document/metadata/ietf_bibliographic_item.rb +0 -2
  99. data/lib/metanorma/ietf_document/root.rb +14 -50
  100. data/lib/metanorma/ietf_document/sections/ietf_annex_section.rb +26 -0
  101. data/lib/metanorma/ietf_document/sections/ietf_clause_section.rb +26 -0
  102. data/lib/metanorma/ietf_document/sections/ietf_content_section.rb +25 -0
  103. data/lib/metanorma/ietf_document/sections/ietf_sections.rb +35 -0
  104. data/lib/metanorma/ietf_document/sections.rb +4 -23
  105. data/lib/metanorma/ietf_document.rb +4 -3
  106. data/lib/metanorma/iho_document/metadata/iho_bib_data_extension_type.rb +0 -2
  107. data/lib/metanorma/iho_document/root.rb +10 -50
  108. data/lib/metanorma/iho_document.rb +0 -3
  109. data/lib/metanorma/iso_document/annotation_container.rb +1 -10
  110. data/lib/metanorma/iso_document/boilerplate.rb +1 -11
  111. data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +2 -2
  112. data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +4 -3
  113. data/lib/metanorma/iso_document/metadata/metanorma_extension.rb +1 -12
  114. data/lib/metanorma/iso_document/root.rb +7 -73
  115. data/lib/metanorma/iso_document/sections/colophon.rb +1 -16
  116. data/lib/metanorma/iso_document/sections/iso_annex_section.rb +11 -133
  117. data/lib/metanorma/iso_document/sections/iso_clause_section.rb +9 -166
  118. data/lib/metanorma/iso_document/sections/iso_foreword_section.rb +5 -90
  119. data/lib/metanorma/iso_document/sections/iso_preface.rb +15 -21
  120. data/lib/metanorma/iso_document/sections/iso_sections.rb +19 -29
  121. data/lib/metanorma/iso_document/sections/iso_terms_section.rb +9 -22
  122. data/lib/metanorma/iso_document/terms/term_expression.rb +2 -47
  123. data/lib/metanorma/iso_document/terms/term_origin.rb +2 -24
  124. data/lib/metanorma/iso_document/terms/term_source.rb +4 -32
  125. data/lib/metanorma/iso_document.rb +2 -2
  126. data/lib/metanorma/itu_document/root.rb +10 -50
  127. data/lib/metanorma/itu_document.rb +0 -2
  128. data/lib/metanorma/jis_document/metadata/jis_bib_data_extension_type.rb +10 -0
  129. data/lib/metanorma/jis_document/metadata/jis_bibliographic_item.rb +15 -0
  130. data/lib/metanorma/jis_document/metadata.rb +12 -0
  131. data/lib/metanorma/jis_document/root.rb +29 -0
  132. data/lib/metanorma/jis_document/sections/jis_annex_section.rb +20 -0
  133. data/lib/metanorma/jis_document/sections.rb +9 -0
  134. data/lib/metanorma/jis_document.rb +11 -0
  135. data/lib/metanorma/m3d_document/metadata/m3d_bib_data_extension_type.rb +10 -0
  136. data/lib/metanorma/m3d_document/metadata/m3d_bibliographic_item.rb +15 -0
  137. data/lib/metanorma/m3d_document/metadata.rb +12 -0
  138. data/lib/metanorma/m3d_document/root.rb +29 -0
  139. data/lib/metanorma/m3d_document.rb +10 -0
  140. data/lib/metanorma/nist_document/metadata/nist_bib_data_extension_type.rb +10 -0
  141. data/lib/metanorma/nist_document/metadata/nist_bibliographic_item.rb +15 -0
  142. data/lib/metanorma/nist_document/metadata.rb +12 -0
  143. data/lib/metanorma/nist_document/root.rb +29 -0
  144. data/lib/metanorma/nist_document/sections/errata.rb +16 -0
  145. data/lib/metanorma/nist_document/sections/errata_clause.rb +20 -0
  146. data/lib/metanorma/nist_document/sections/errata_row.rb +22 -0
  147. data/lib/metanorma/nist_document/sections/nist_preface.rb +30 -0
  148. data/lib/metanorma/nist_document/sections.rb +12 -0
  149. data/lib/metanorma/nist_document.rb +11 -0
  150. data/lib/metanorma/ogc_document/root.rb +10 -50
  151. data/lib/metanorma/ogc_document.rb +0 -2
  152. data/lib/metanorma/oiml_document/root.rb +8 -47
  153. data/lib/metanorma/oiml_document.rb +2 -3
  154. data/lib/metanorma/plateau_document/metadata/plateau_bibliographic_item.rb +13 -0
  155. data/lib/metanorma/plateau_document/metadata.rb +10 -0
  156. data/lib/metanorma/plateau_document/root.rb +29 -0
  157. data/lib/metanorma/plateau_document.rb +10 -0
  158. data/lib/metanorma/registers/setup.rb +162 -0
  159. data/lib/metanorma/registers.rb +7 -0
  160. data/lib/metanorma/ribose_document/root.rb +10 -52
  161. data/lib/metanorma/ribose_document.rb +0 -2
  162. data/lib/metanorma/standard_document/annotation_container.rb +14 -0
  163. data/lib/metanorma/standard_document/block_attributes.rb +268 -0
  164. data/lib/metanorma/standard_document/blocks/passthrough.rb +1 -18
  165. data/lib/metanorma/standard_document/blocks/requirement_model.rb +18 -163
  166. data/lib/metanorma/standard_document/boilerplate.rb +14 -0
  167. data/lib/metanorma/standard_document/elements/add.rb +1 -17
  168. data/lib/metanorma/standard_document/elements/del.rb +1 -17
  169. data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +16 -0
  170. data/lib/metanorma/standard_document/metadata.rb +2 -0
  171. data/lib/metanorma/standard_document/refs/reference_to_term.rb +2 -1
  172. data/lib/metanorma/standard_document/root_attributes.rb +78 -0
  173. data/lib/metanorma/standard_document/sections/abstract.rb +1 -3
  174. data/lib/metanorma/standard_document/sections/acknowledgements.rb +1 -3
  175. data/lib/metanorma/standard_document/sections/annex_section.rb +56 -19
  176. data/lib/metanorma/standard_document/sections/bibliography_section.rb +1 -2
  177. data/lib/metanorma/standard_document/sections/clause_section.rb +75 -13
  178. data/lib/metanorma/standard_document/sections/colophon.rb +16 -0
  179. data/lib/metanorma/standard_document/sections/definition_section.rb +43 -46
  180. data/lib/metanorma/standard_document/sections/floating_section_title.rb +23 -0
  181. data/lib/metanorma/standard_document/sections/foreword.rb +1 -3
  182. data/lib/metanorma/standard_document/sections/introduction.rb +1 -4
  183. data/lib/metanorma/standard_document/sections/misc_container.rb +5 -2
  184. data/lib/metanorma/standard_document/sections/preface.rb +36 -0
  185. data/lib/metanorma/standard_document/sections/sections.rb +40 -0
  186. data/lib/metanorma/standard_document/sections/standard_content_section.rb +26 -12
  187. data/lib/metanorma/standard_document/sections/terms_section.rb +45 -13
  188. data/lib/metanorma/standard_document/sections.rb +6 -2
  189. data/lib/metanorma/standard_document/terms/designation.rb +1 -1
  190. data/lib/metanorma/standard_document/terms/term_expression.rb +51 -0
  191. data/lib/metanorma/standard_document/terms.rb +1 -0
  192. data/lib/metanorma/standard_document.rb +10 -2
  193. data/lib/metanorma/un_document/metadata/un_bib_data_extension_type.rb +10 -0
  194. data/lib/metanorma/un_document/metadata/un_bibliographic_item.rb +15 -0
  195. data/lib/metanorma/un_document/metadata.rb +12 -0
  196. data/lib/metanorma/un_document/root.rb +29 -0
  197. data/lib/metanorma/un_document/sections/un_preface.rb +23 -0
  198. data/lib/metanorma/un_document/sections/un_sections.rb +24 -0
  199. data/lib/metanorma/un_document/sections.rb +10 -0
  200. data/lib/metanorma/un_document.rb +11 -0
  201. metadata +77 -3
  202. data/lib/metanorma/html/whitespace_patch.rb +0 -47
@@ -3,71 +3,68 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  module Sections
6
- # Definition sections consist of one or more definition lists (`DefinitionCollection`),
7
- # are used to define symbols and
8
- # abbreviations used in the remainder of the document.
6
+ # Definition sections consist of one or more definition lists,
7
+ # used to define symbols and abbreviations used in the remainder of
8
+ # the document.
9
9
  #
10
- # They can also be used as glossaries, with simple definitions,
11
- # in contrast to the more elaborate definitions given in
12
- # terms sections.
13
- #
14
- # In addition to allowing prefatory text per section, each definition list
15
- # within each definition section can also be preceded by prefatory text.
16
- class DefinitionSection < Metanorma::StandardDocument::Sections::ClauseSection
17
- attribute :definitions, DefinitionSection, collection: true
10
+ # Corresponds to isodoc.rnc:
11
+ # definitions = element definitions {
12
+ # Section-Attributes,
13
+ # ( (BasicBlock+) | (dl+) )?,
14
+ # definitions*
15
+ # }
16
+ class DefinitionSection < Lutaml::Model::Serializable
17
+ include Metanorma::StandardDocument::PresentationAttributes
18
+
19
+ attribute :id, :string
18
20
  attribute :type, :string
21
+ attribute :number, :string
19
22
  attribute :obligation, :string
23
+ attribute :inline_header, :string
24
+ attribute :unnumbered, :string
25
+ attribute :toc, :string
26
+ attribute :class_attr, :string
27
+ attribute :title,
28
+ Metanorma::Document::Components::Inline::TitleWithAnnotationElement
20
29
 
21
30
  # Block content
22
- attribute :id, :string
23
- attribute :anchor, :string
24
- attribute :title, Metanorma::Document::Components::Inline::TitleWithAnnotationElement
25
31
  attribute :paragraphs,
26
32
  Metanorma::Document::Components::Paragraphs::ParagraphBlock,
27
33
  collection: true
28
- attribute :definition_lists,
29
- Metanorma::Document::Components::Lists::DefinitionList,
30
- collection: true
31
34
  attribute :unordered_lists,
32
35
  Metanorma::Document::Components::Lists::UnorderedList,
33
36
  collection: true
34
- attribute :example,
35
- Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
36
- collection: true
37
- attribute :table,
37
+ attribute :tables,
38
38
  Metanorma::Document::Components::Tables::TableBlock,
39
39
  collection: true
40
-
41
- attribute :semx_id, :string
42
- attribute :original_id, :string
43
- attribute :autonum, :string
44
- attribute :displayorder, :integer
45
-
46
- # Presentation-specific
47
- attribute :fmt_title, Metanorma::Document::Components::Inline::FmtTitleElement
48
- attribute :fmt_xref_label, Metanorma::Document::Components::Inline::FmtXrefLabelElement,
40
+ attribute :definition_lists,
41
+ Metanorma::Document::Components::Lists::DefinitionList,
42
+ collection: true
43
+ attribute :examples,
44
+ Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
49
45
  collection: true
50
46
 
47
+ # Recursive definitions
48
+ attribute :definitions, DefinitionSection, collection: true
49
+
51
50
  xml do
52
51
  element "definitions"
53
52
  ordered
54
- map_attribute "id", to: :id
55
- map_attribute "anchor", to: :anchor
56
- map_attribute "type", to: :type
57
- map_attribute "obligation", to: :obligation
58
- map_element "title", to: :title
59
- map_element "p", to: :paragraphs
60
- map_element "dl", to: :definition_lists
61
- map_element "ul", to: :unordered_lists
62
- map_element "example", to: :example
63
- map_element "table", to: :table
64
- map_element "definitions", to: :definitions
65
- map_element "fmt-title", to: :fmt_title
53
+
54
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
55
+
56
+ map_element "title", to: :title
57
+ map_element "variant-title", to: :variant_title
58
+ map_element "p", to: :paragraphs
59
+ map_element "ul", to: :unordered_lists
60
+ map_element "table", to: :tables
61
+ map_element "dl", to: :definition_lists
62
+ map_element "example", to: :examples
63
+ map_element "definitions", to: :definitions
64
+ map_element "fmt-title", to: :fmt_title
66
65
  map_element "fmt-xref-label", to: :fmt_xref_label
67
- map_attribute "semx-id", to: :semx_id
68
- map_attribute "original-id", to: :original_id
69
- map_attribute "autonum", to: :autonum
70
- map_attribute "displayorder", to: :displayorder
66
+ map_element "fmt-annotation-start", to: :fmt_annotation_start
67
+ map_element "fmt-annotation-end", to: :fmt_annotation_end
71
68
  end
72
69
  end
73
70
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Sections
6
+ # A floating section title used in BSI and JIS documents.
7
+ # Differs from FloatingTitle: uses element name "section-title",
8
+ # has id (not derived from StandardBlockNoNotes), and contains TextElement.
9
+ class FloatingSectionTitle < Lutaml::Model::Serializable
10
+ attribute :id, :string
11
+ attribute :depth, :integer
12
+ attribute :text, :string, collection: true
13
+
14
+ xml do
15
+ element "section-title"
16
+ map_attribute "id", to: :id
17
+ map_attribute "depth", to: :depth
18
+ map_content to: :text
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -4,10 +4,8 @@ module Metanorma
4
4
  module StandardDocument
5
5
  module Sections
6
6
  # Foreword of document.
7
- class Foreword < Metanorma::StandardDocument::Sections::StandardContentSection
8
- attribute :semx_id, :string
7
+ class Foreword < Metanorma::StandardDocument::Sections::ContentSection
9
8
  attribute :original_id, :string
10
- attribute :displayorder, :integer
11
9
  xml do
12
10
  element "foreword"
13
11
 
@@ -4,11 +4,8 @@ module Metanorma
4
4
  module StandardDocument
5
5
  module Sections
6
6
  # Introduction of document.
7
- class Introduction < Metanorma::StandardDocument::Sections::StandardContentSection
8
- attribute :semx_id, :string
7
+ class Introduction < Metanorma::StandardDocument::Sections::ContentSection
9
8
  attribute :original_id, :string
10
- attribute :autonum, :string
11
- attribute :displayorder, :integer
12
9
  xml do
13
10
  element "introduction"
14
11
 
@@ -5,8 +5,11 @@ module Metanorma
5
5
  module Sections
6
6
  # Extension point for extraneous elements that need to be added to standards document
7
7
  # from other schemas, e.g. UnitsML.
8
+ #
9
+ # Content is stored as raw XML text since the children come from external
10
+ # vocabularies not defined in the metanorma schema.
8
11
  class MiscContainer < Lutaml::Model::Serializable
9
- attribute :element, Object, collection: true
12
+ attribute :content, :string
10
13
 
11
14
  attribute :semx_id, :string
12
15
  attribute :original_id, :string
@@ -14,7 +17,7 @@ module Metanorma
14
17
 
15
18
  xml do
16
19
  element "misc-container"
17
- map_element "element", to: :element
20
+ map_content to: :content
18
21
 
19
22
  map_attribute "semx-id", to: :semx_id
20
23
  map_attribute "original-id", to: :original_id
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Sections
6
+ # Container for preface sections.
7
+ # Corresponds to isodoc.rnc:
8
+ # preface = element preface {
9
+ # ( content | abstract | foreword | introduction |
10
+ # acknowledgements | executivesummary )+
11
+ # }
12
+ class Preface < Lutaml::Model::Serializable
13
+ attribute :abstract, ContentSection
14
+ attribute :foreword, ContentSection
15
+ attribute :introduction, ContentSection
16
+ attribute :acknowledgements, ContentSection
17
+ attribute :executivesummary, ContentSection
18
+ attribute :content, ContentSection, collection: true
19
+
20
+ # Presentation-specific attributes
21
+ attribute :semx_id, :string
22
+ attribute :displayorder, :integer
23
+
24
+ xml do
25
+ element "preface"
26
+ ordered
27
+
28
+ Metanorma::StandardDocument::SectionXmlMapping.apply_preface_elements(self)
29
+ map_element "clause", to: :content
30
+
31
+ Metanorma::StandardDocument::SectionXmlMapping.apply_preface_attributes(self)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Sections
6
+ # Container for the main body sections of a document.
7
+ # Corresponds to isodoc.rnc:
8
+ # sections = element sections {
9
+ # ( clause | terms | term-clause | definitions | floating-title )+
10
+ # }
11
+ class Sections < Lutaml::Model::Serializable
12
+ attribute :clause, ClauseSection, collection: true
13
+ attribute :terms,
14
+ Metanorma::StandardDocument::Sections::TermsSection,
15
+ collection: true
16
+ attribute :definitions,
17
+ Metanorma::StandardDocument::Sections::DefinitionSection,
18
+ collection: true
19
+ attribute :floating_title,
20
+ Metanorma::StandardDocument::Sections::FloatingTitle,
21
+ collection: true
22
+ attribute :references,
23
+ Metanorma::StandardDocument::Sections::StandardReferencesSection,
24
+ collection: true
25
+
26
+ # Presentation-specific attributes
27
+ attribute :semx_id, :string
28
+ attribute :displayorder, :integer
29
+
30
+ xml do
31
+ element "sections"
32
+ ordered
33
+
34
+ Metanorma::StandardDocument::SectionXmlMapping.apply_sections_elements(self)
35
+ Metanorma::StandardDocument::SectionXmlMapping.apply_sections_attributes(self)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -3,23 +3,37 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  module Sections
6
- # An unnumbered clause, outside the main body of text of a _StandardDocument_.
7
- class StandardContentSection < Metanorma::StandardDocument::Sections::StandardHierarchicalSection
6
+ # A content section used for preface elements (abstract, foreword,
7
+ # introduction, acknowledgements, executivesummary) and generic clauses
8
+ # within preface.
9
+ # Corresponds to isodoc.rnc `Content-Section`:
10
+ # Section-Attributes, type?, title?,
11
+ # ( BasicBlock*, content-subsection* )
12
+ class ContentSection < Lutaml::Model::Serializable
13
+ include Metanorma::StandardDocument::BlockAttributes
14
+ include Metanorma::StandardDocument::PresentationAttributes
15
+
16
+ # Section identity
17
+ attribute :id, :string
8
18
  attribute :type, :string
19
+ attribute :number, :string
20
+ attribute :obligation, :string
21
+ attribute :inline_header, :string
22
+ attribute :unnumbered, :string
23
+ attribute :toc, :string
24
+ attribute :class_attr, :string
25
+ attribute :title,
26
+ Metanorma::Document::Components::Inline::TitleWithAnnotationElement
9
27
 
10
- attribute :semx_id, :string
11
- attribute :original_id, :string
12
- attribute :autonum, :string
13
- attribute :displayorder, :integer
28
+ # Nested content subsections (recursive)
29
+ attribute :subsection, ContentSection, collection: true
14
30
 
15
31
  xml do
16
- element "standard-content-section"
17
- map_attribute "type", to: :type
32
+ element "clause"
33
+ ordered
18
34
 
19
- map_attribute "semx-id", to: :semx_id
20
- map_attribute "original-id", to: :original_id
21
- map_attribute "autonum", to: :autonum
22
- map_attribute "displayorder", to: :displayorder
35
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
36
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_elements(self)
23
37
  end
24
38
  end
25
39
  end
@@ -3,25 +3,57 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  module Sections
6
- # Term sections give elaborated definitions of terms used in a standardization document.
7
- # The <terms> element contains <title>, <p>, <ul>, <term> children.
8
- class TermsSection < Metanorma::StandardDocument::Sections::ClauseSection
9
- attribute :terms, Metanorma::StandardDocument::Terms::Term,
6
+ # Term sections give elaborated definitions of terms used in a
7
+ # standardization document.
8
+ #
9
+ # Corresponds to isodoc.rnc:
10
+ # terms = element terms {
11
+ # Section-Attributes, title?,
12
+ # ( paragraph | ul )*,
13
+ # term+
14
+ # }
15
+ class TermsSection < Lutaml::Model::Serializable
16
+ include Metanorma::StandardDocument::PresentationAttributes
17
+
18
+ attribute :id, :string
19
+ attribute :type, :string
20
+ attribute :number, :string
21
+ attribute :obligation, :string
22
+ attribute :inline_header, :string
23
+ attribute :unnumbered, :string
24
+ attribute :toc, :string
25
+ attribute :class_attr, :string
26
+ attribute :title,
27
+ Metanorma::Document::Components::Inline::TitleWithAnnotationElement
28
+
29
+ # Prefatory paragraphs before term entries
30
+ attribute :paragraphs,
31
+ Metanorma::Document::Components::Paragraphs::ParagraphBlock,
32
+ collection: true
33
+ attribute :unordered_lists,
34
+ Metanorma::Document::Components::Lists::UnorderedList,
10
35
  collection: true
11
36
 
12
- attribute :semx_id, :string
13
- attribute :original_id, :string
14
- attribute :autonum, :string
15
- attribute :displayorder, :integer
37
+ # Term entries
38
+ attribute :terms,
39
+ Metanorma::StandardDocument::Terms::Term,
40
+ collection: true
16
41
 
17
42
  xml do
18
43
  element "terms"
19
- map_element "term", to: :terms
44
+ ordered
45
+
46
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
20
47
 
21
- map_attribute "semx-id", to: :semx_id
22
- map_attribute "original-id", to: :original_id
23
- map_attribute "autonum", to: :autonum
24
- map_attribute "displayorder", to: :displayorder
48
+ map_element "title", to: :title
49
+ map_element "variant-title", to: :variant_title
50
+ map_element "fmt-title", to: :fmt_title
51
+ map_element "fmt-xref-label", to: :fmt_xref_label
52
+ map_element "p", to: :paragraphs
53
+ map_element "ul", to: :unordered_lists
54
+ map_element "term", to: :terms
55
+ map_element "fmt-annotation-start", to: :fmt_annotation_start
56
+ map_element "fmt-annotation-end", to: :fmt_annotation_end
25
57
  end
26
58
  end
27
59
  end
@@ -7,18 +7,22 @@ module Metanorma
7
7
  autoload :Acknowledgements, "#{__dir__}/sections/acknowledgements"
8
8
  autoload :AnnexSection, "#{__dir__}/sections/annex_section"
9
9
  autoload :BibliographySection, "#{__dir__}/sections/bibliography_section"
10
+ autoload :Colophon, "#{__dir__}/sections/colophon"
10
11
  autoload :BoilerplateType, "#{__dir__}/sections/boilerplate_type"
11
12
  autoload :ClauseHierarchicalSection,
12
13
  "#{__dir__}/sections/clause_hierarchical_section"
13
14
  autoload :ClauseSection, "#{__dir__}/sections/clause_section"
15
+ autoload :ContentSection, "#{__dir__}/sections/standard_content_section"
14
16
  autoload :DefinitionSection, "#{__dir__}/sections/definition_section"
17
+ autoload :FloatingSectionTitle,
18
+ "#{__dir__}/sections/floating_section_title"
15
19
  autoload :FloatingTitle, "#{__dir__}/sections/floating_title"
16
20
  autoload :Foreword, "#{__dir__}/sections/foreword"
17
21
  autoload :Introduction, "#{__dir__}/sections/introduction"
18
22
  autoload :MiscContainer, "#{__dir__}/sections/misc_container"
19
23
  autoload :NormativeType, "#{__dir__}/sections/normative_type"
20
- autoload :StandardContentSection,
21
- "#{__dir__}/sections/standard_content_section"
24
+ autoload :Preface, "#{__dir__}/sections/preface"
25
+ autoload :Sections, "#{__dir__}/sections/sections"
22
26
  autoload :StandardHierarchicalSection,
23
27
  "#{__dir__}/sections/standard_hierarchical_section"
24
28
  autoload :StandardReferencesSection,
@@ -10,7 +10,7 @@ module Metanorma
10
10
  Metanorma::Document::Components::DataTypes::Iso3166Code, collection: true
11
11
  attribute :sources, Metanorma::StandardDocument::Terms::TermSource,
12
12
  collection: true
13
- attribute :expression, Metanorma::IsoDocument::Terms::TermExpression
13
+ attribute :expression, Metanorma::StandardDocument::Terms::TermExpression
14
14
 
15
15
  attribute :semx_id, :string
16
16
  attribute :original_id, :string
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module StandardDocument
5
+ module Terms
6
+ class TermNameElement < Lutaml::Model::Serializable
7
+ attribute :id, :string
8
+ attribute :semx_id, :string
9
+ attribute :lang, :string
10
+ attribute :text, :string, collection: true
11
+ attribute :strike, Metanorma::Document::Components::TextElements::StrikeElement,
12
+ collection: true
13
+ attribute :em, Metanorma::Document::Components::Inline::EmRawElement,
14
+ collection: true
15
+ attribute :strong, Metanorma::Document::Components::Inline::StrongRawElement,
16
+ collection: true
17
+ attribute :sup, Metanorma::Document::Components::Inline::SupElement,
18
+ collection: true
19
+ attribute :sub, Metanorma::Document::Components::Inline::SubElement,
20
+ collection: true
21
+
22
+ xml do
23
+ element "name"
24
+ map_attribute "id", to: :id
25
+ map_attribute "semx-id", to: :semx_id
26
+ map_attribute "lang", to: :lang
27
+ mixed_content
28
+ map_content to: :text
29
+ map_element "strike", to: :strike
30
+ map_element "em", to: :em
31
+ map_element "strong", to: :strong
32
+ map_element "sup", to: :sup
33
+ map_element "sub", to: :sub
34
+ end
35
+ end
36
+
37
+ class TermExpression < Lutaml::Model::Serializable
38
+ attribute :name, TermNameElement, collection: true
39
+ attribute :usage, :string
40
+ attribute :abbreviation_type, :string
41
+
42
+ xml do
43
+ element "expression"
44
+ map_element "name", to: :name
45
+ map_element "usage", to: :usage
46
+ map_element "abbreviation-type", to: :abbreviation_type
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -22,6 +22,7 @@ module Metanorma
22
22
  autoload :Term, "#{__dir__}/terms/term"
23
23
  autoload :TermCollection, "#{__dir__}/terms/term_collection"
24
24
  autoload :TermDefinition, "#{__dir__}/terms/term_definition"
25
+ autoload :TermExpression, "#{__dir__}/terms/term_expression"
25
26
  autoload :TermSource, "#{__dir__}/terms/term_source"
26
27
  autoload :TermSourceStatus, "#{__dir__}/terms/term_source_status"
27
28
  autoload :TermSourceType, "#{__dir__}/terms/term_source_type"
@@ -1,16 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "metanorma/document"
4
-
5
3
  module Metanorma
6
4
  module StandardDocument
5
+ autoload :AnnotationContainer,
6
+ "metanorma/standard_document/annotation_container"
7
+ autoload :BlockAttributes, "metanorma/standard_document/block_attributes"
8
+ autoload :BlockXmlMapping, "metanorma/standard_document/block_attributes"
9
+ autoload :SectionXmlMapping, "metanorma/standard_document/block_attributes"
10
+ autoload :PresentationAttributes,
11
+ "metanorma/standard_document/block_attributes"
12
+ autoload :OrderedContent, "metanorma/standard_document/block_attributes"
7
13
  autoload :Blocks, "metanorma/standard_document/blocks"
14
+ autoload :Boilerplate, "metanorma/standard_document/boilerplate"
8
15
  autoload :Elements, "metanorma/standard_document/elements"
9
16
  autoload :Lists, "metanorma/standard_document/lists"
10
17
  autoload :Metadata, "metanorma/standard_document/metadata"
11
18
  autoload :Namespace, "metanorma/standard_document/namespace"
12
19
  autoload :Refs, "metanorma/standard_document/refs"
13
20
  autoload :Root, "metanorma/standard_document/root"
21
+ autoload :RootAttributes, "metanorma/standard_document/root_attributes"
14
22
  autoload :Sections, "metanorma/standard_document/sections"
15
23
  autoload :StandardDocumentType,
16
24
  "metanorma/standard_document/standard_document_type"
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Metadata
6
+ class UnBibDataExtensionType < Metanorma::IsoDocument::Metadata::IsoBibDataExtensionType
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Metadata
6
+ class UnBibliographicItem < Metanorma::IsoDocument::Metadata::IsoBibliographicItem
7
+ attribute :ext, UnBibDataExtensionType
8
+
9
+ xml do
10
+ element "bibdata"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Metadata
6
+ autoload :UnBibDataExtensionType,
7
+ "#{__dir__}/metadata/un_bib_data_extension_type"
8
+ autoload :UnBibliographicItem,
9
+ "#{__dir__}/metadata/un_bibliographic_item"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ class Root < Lutaml::Model::Serializable
6
+ include Metanorma::StandardDocument::RootAttributes
7
+
8
+ def self.lutaml_default_register
9
+ :un_document
10
+ end
11
+
12
+ attribute :bibdata, Metadata::UnBibliographicItem
13
+ attribute :preface,
14
+ UnDocument::Sections::UnPreface
15
+ attribute :sections,
16
+ UnDocument::Sections::UnSections
17
+ attribute :annex,
18
+ Metanorma::StandardDocument::Sections::AnnexSection,
19
+ collection: true
20
+
21
+ xml do
22
+ element "metanorma"
23
+ namespace Metanorma::StandardDocument::Namespace
24
+
25
+ Metanorma::StandardDocument::RootXmlMapping.apply(self)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Sections
6
+ # UN preface with only abstract, foreword, introduction.
7
+ # Corresponds to un.rnc:
8
+ # preface = element preface { abstract?, foreword?, introduction? }
9
+ class UnPreface < Metanorma::StandardDocument::Sections::Preface
10
+ xml do
11
+ element "preface"
12
+ ordered
13
+
14
+ map_element "abstract", to: :abstract
15
+ map_element "foreword", to: :foreword
16
+ map_element "introduction", to: :introduction
17
+
18
+ Metanorma::StandardDocument::SectionXmlMapping.apply_preface_attributes(self)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Sections
6
+ # UN sections container.
7
+ # Corresponds to un.rnc:
8
+ # sections = element sections { (clause | floating-title)+ }
9
+ #
10
+ # UN does not allow terms/definitions at top level of sections.
11
+ class UnSections < Metanorma::StandardDocument::Sections::Sections
12
+ xml do
13
+ element "sections"
14
+ ordered
15
+
16
+ map_element "clause", to: :clause
17
+ map_element "floating-title", to: :floating_title
18
+
19
+ Metanorma::StandardDocument::SectionXmlMapping.apply_sections_attributes(self)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ module Sections
6
+ autoload :UnPreface, "#{__dir__}/sections/un_preface"
7
+ autoload :UnSections, "#{__dir__}/sections/un_sections"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module UnDocument
5
+ autoload :Metadata, "metanorma/un_document/metadata"
6
+ autoload :Root, "metanorma/un_document/root"
7
+ autoload :Sections, "metanorma/un_document/sections"
8
+ end
9
+ end
10
+
11
+ Metanorma::Registers::Setup.setup_un_register