metanorma-document 0.2.5 → 0.2.7
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.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +321 -45
- data/Gemfile +2 -0
- data/lib/metanorma/basic_document/ancillary_blocks/figure_block.rb +3 -1
- data/lib/metanorma/basic_document/blocks/basic_block.rb +5 -1
- data/lib/metanorma/basic_document/blocks/note_block.rb +5 -0
- data/lib/metanorma/basic_document/blocks.rb +3 -24
- data/lib/metanorma/basic_document/lists/list.rb +2 -1
- data/lib/metanorma/basic_document/lists/list_item.rb +17 -0
- data/lib/metanorma/basic_document/lists.rb +1 -0
- data/lib/metanorma/basic_document/paragraphs/paragraph_with_footnote.rb +3 -1
- data/lib/metanorma/basic_document/reference_elements/callout.rb +1 -1
- data/lib/metanorma/basic_document/reference_elements/footnote.rb +1 -1
- data/lib/metanorma/basic_document/text_elements/mathml.rb +1 -1
- data/lib/metanorma/bipm_document/root.rb +10 -50
- data/lib/metanorma/bipm_document.rb +0 -2
- data/lib/metanorma/bsi_document/metadata/bsi_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/bsi_document/metadata/bsi_bibliographic_item.rb +15 -0
- data/lib/metanorma/bsi_document/metadata.rb +12 -0
- data/lib/metanorma/bsi_document/root.rb +29 -0
- data/lib/metanorma/bsi_document/sections/bsi_annex_section.rb +25 -0
- data/lib/metanorma/bsi_document/sections/bsi_clause_section.rb +25 -0
- data/lib/metanorma/bsi_document/sections/bsi_sections.rb +27 -0
- data/lib/metanorma/bsi_document/sections.rb +11 -0
- data/lib/metanorma/bsi_document.rb +11 -0
- data/lib/metanorma/cc_document/root.rb +10 -50
- data/lib/metanorma/cc_document.rb +0 -2
- data/lib/metanorma/collection.rb +0 -2
- data/lib/metanorma/document/components/ancillary_blocks/example_block.rb +3 -3
- data/lib/metanorma/document/components/ancillary_blocks/figure_block.rb +2 -0
- data/lib/metanorma/document/components/ancillary_blocks/sourcecode_block.rb +2 -0
- data/lib/metanorma/document/components/blocks/passthrough.rb +21 -0
- data/lib/metanorma/document/components/blocks/requirement_model.rb +159 -0
- data/lib/metanorma/document/components/blocks.rb +10 -0
- data/lib/metanorma/document/components/contrib_metadata/contribution_element_metadata.rb +3 -1
- data/lib/metanorma/document/components/id_elements/image.rb +2 -0
- data/lib/metanorma/document/components/inline/xref_element.rb +8 -0
- data/lib/metanorma/document/components/lists/definition_list.rb +6 -0
- data/lib/metanorma/document/components/lists/list_item.rb +1 -1
- data/lib/metanorma/document/components/lists/ordered_list.rb +6 -0
- data/lib/metanorma/document/components/lists/unordered_list.rb +8 -0
- data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +8 -0
- data/lib/metanorma/document/components/multi_paragraph/review_block.rb +3 -0
- data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +6 -2
- data/lib/metanorma/document/components/reference_elements/source_element.rb +57 -0
- data/lib/metanorma/document/components/reference_elements.rb +6 -0
- data/lib/metanorma/document/components/sections/references_section.rb +1 -1
- data/lib/metanorma/document/components/tables/table_block.rb +10 -0
- data/lib/metanorma/document/components/tables/table_cell.rb +2 -1
- data/lib/metanorma/document/data_types.rb +0 -4
- data/lib/metanorma/document/elements/add.rb +18 -0
- data/lib/metanorma/document/elements/del.rb +18 -0
- data/lib/metanorma/document/elements.rb +10 -0
- data/lib/metanorma/document/relaton/address.rb +16 -0
- data/lib/metanorma/document/root.rb +1 -3
- data/lib/metanorma/document/version.rb +1 -1
- data/lib/metanorma/document.rb +11 -2
- data/lib/metanorma/gb_document/metadata/gb_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/gb_document/metadata/gb_bibliographic_item.rb +15 -0
- data/lib/metanorma/gb_document/metadata.rb +12 -0
- data/lib/metanorma/gb_document/root.rb +29 -0
- data/lib/metanorma/gb_document.rb +10 -0
- data/lib/metanorma/generic_document/root.rb +31 -0
- data/lib/metanorma/generic_document.rb +7 -0
- data/lib/metanorma/html/base_renderer.rb +245 -113
- data/lib/metanorma/html/bipm_renderer.rb +16 -8
- data/lib/metanorma/html/cc_renderer.rb +0 -1
- data/lib/metanorma/html/component/base.rb +5 -1
- data/lib/metanorma/html/component/footnote_collector.rb +3 -3
- data/lib/metanorma/html/component/index_section.rb +27 -9
- data/lib/metanorma/html/component/index_term_collector.rb +8 -3
- data/lib/metanorma/html/component.rb +2 -1
- data/lib/metanorma/html/drops/admonition_drop.rb +2 -1
- data/lib/metanorma/html/drops/example_drop.rb +2 -11
- data/lib/metanorma/html/drops/figure_drop.rb +14 -5
- data/lib/metanorma/html/drops/formula_drop.rb +7 -2
- data/lib/metanorma/html/drops/note_drop.rb +2 -3
- data/lib/metanorma/html/drops/sourcecode_drop.rb +6 -2
- data/lib/metanorma/html/drops.rb +2 -1
- data/lib/metanorma/html/generator.rb +33 -16
- data/lib/metanorma/html/iec_renderer.rb +0 -1
- data/lib/metanorma/html/ieee_renderer.rb +0 -1
- data/lib/metanorma/html/ietf_renderer.rb +0 -1
- data/lib/metanorma/html/iho_renderer.rb +1 -2
- data/lib/metanorma/html/iso_renderer.rb +68 -23
- data/lib/metanorma/html/itu_renderer.rb +0 -1
- data/lib/metanorma/html/ogc_renderer.rb +0 -1
- data/lib/metanorma/html/oiml_renderer.rb +0 -1
- data/lib/metanorma/html/pdfa_renderer.rb +0 -1
- data/lib/metanorma/html/ribose_renderer.rb +0 -1
- data/lib/metanorma/html/standard_renderer.rb +61 -28
- data/lib/metanorma/html/theme.rb +2 -2
- data/lib/metanorma/html.rb +48 -1
- data/lib/metanorma/iec_document/root.rb +8 -47
- data/lib/metanorma/iec_document.rb +2 -3
- data/lib/metanorma/ieee_document/root.rb +14 -50
- data/lib/metanorma/ieee_document/sections/ieee_sections.rb +31 -0
- data/lib/metanorma/ieee_document/sections.rb +9 -0
- data/lib/metanorma/ieee_document.rb +3 -3
- data/lib/metanorma/ietf_document/metadata/ietf_bib_data_extension_type.rb +0 -2
- data/lib/metanorma/ietf_document/metadata/ietf_bibliographic_item.rb +0 -2
- data/lib/metanorma/ietf_document/root.rb +14 -50
- data/lib/metanorma/ietf_document/sections/ietf_annex_section.rb +26 -0
- data/lib/metanorma/ietf_document/sections/ietf_clause_section.rb +26 -0
- data/lib/metanorma/ietf_document/sections/ietf_content_section.rb +25 -0
- data/lib/metanorma/ietf_document/sections/ietf_sections.rb +35 -0
- data/lib/metanorma/ietf_document/sections.rb +4 -23
- data/lib/metanorma/ietf_document.rb +4 -3
- data/lib/metanorma/iho_document/metadata/iho_bib_data_extension_type.rb +0 -2
- data/lib/metanorma/iho_document/root.rb +10 -50
- data/lib/metanorma/iho_document.rb +0 -3
- data/lib/metanorma/iso_document/annotation_container.rb +1 -10
- data/lib/metanorma/iso_document/boilerplate.rb +1 -11
- data/lib/metanorma/iso_document/metadata/iso_bibliographic_item.rb +2 -2
- data/lib/metanorma/iso_document/metadata/iso_localized_title.rb +4 -3
- data/lib/metanorma/iso_document/metadata/metanorma_extension.rb +1 -12
- data/lib/metanorma/iso_document/root.rb +7 -73
- data/lib/metanorma/iso_document/sections/colophon.rb +1 -16
- data/lib/metanorma/iso_document/sections/iso_annex_section.rb +11 -133
- data/lib/metanorma/iso_document/sections/iso_clause_section.rb +9 -166
- data/lib/metanorma/iso_document/sections/iso_foreword_section.rb +15 -89
- data/lib/metanorma/iso_document/sections/iso_preface.rb +15 -21
- data/lib/metanorma/iso_document/sections/iso_sections.rb +19 -29
- data/lib/metanorma/iso_document/sections/iso_terms_section.rb +6 -9
- data/lib/metanorma/iso_document/terms/term_expression.rb +2 -47
- data/lib/metanorma/iso_document/terms/term_origin.rb +2 -24
- data/lib/metanorma/iso_document/terms/term_source.rb +4 -32
- data/lib/metanorma/iso_document.rb +2 -2
- data/lib/metanorma/itu_document/root.rb +10 -50
- data/lib/metanorma/itu_document.rb +0 -2
- data/lib/metanorma/jis_document/metadata/jis_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/jis_document/metadata/jis_bibliographic_item.rb +15 -0
- data/lib/metanorma/jis_document/metadata.rb +12 -0
- data/lib/metanorma/jis_document/root.rb +29 -0
- data/lib/metanorma/jis_document/sections/jis_annex_section.rb +20 -0
- data/lib/metanorma/jis_document/sections.rb +9 -0
- data/lib/metanorma/jis_document.rb +11 -0
- data/lib/metanorma/m3d_document/metadata/m3d_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/m3d_document/metadata/m3d_bibliographic_item.rb +15 -0
- data/lib/metanorma/m3d_document/metadata.rb +12 -0
- data/lib/metanorma/m3d_document/root.rb +29 -0
- data/lib/metanorma/m3d_document.rb +10 -0
- data/lib/metanorma/nist_document/metadata/nist_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/nist_document/metadata/nist_bibliographic_item.rb +15 -0
- data/lib/metanorma/nist_document/metadata.rb +12 -0
- data/lib/metanorma/nist_document/root.rb +29 -0
- data/lib/metanorma/nist_document/sections/errata.rb +16 -0
- data/lib/metanorma/nist_document/sections/errata_clause.rb +20 -0
- data/lib/metanorma/nist_document/sections/errata_row.rb +22 -0
- data/lib/metanorma/nist_document/sections/nist_preface.rb +30 -0
- data/lib/metanorma/nist_document/sections.rb +12 -0
- data/lib/metanorma/nist_document.rb +11 -0
- data/lib/metanorma/ogc_document/root.rb +10 -50
- data/lib/metanorma/ogc_document.rb +0 -2
- data/lib/metanorma/oiml_document/root.rb +8 -47
- data/lib/metanorma/oiml_document.rb +2 -3
- data/lib/metanorma/plateau_document/metadata/plateau_bibliographic_item.rb +13 -0
- data/lib/metanorma/plateau_document/metadata.rb +10 -0
- data/lib/metanorma/plateau_document/root.rb +29 -0
- data/lib/metanorma/plateau_document.rb +10 -0
- data/lib/metanorma/registers/setup.rb +162 -0
- data/lib/metanorma/registers.rb +7 -0
- data/lib/metanorma/ribose_document/root.rb +10 -52
- data/lib/metanorma/ribose_document.rb +0 -2
- data/lib/metanorma/standard_document/annotation_container.rb +14 -0
- data/lib/metanorma/standard_document/block_attributes.rb +226 -0
- data/lib/metanorma/standard_document/blocks/passthrough.rb +1 -18
- data/lib/metanorma/standard_document/blocks/requirement_model.rb +18 -163
- data/lib/metanorma/standard_document/boilerplate.rb +14 -0
- data/lib/metanorma/standard_document/elements/add.rb +1 -17
- data/lib/metanorma/standard_document/elements/del.rb +1 -17
- data/lib/metanorma/standard_document/metadata/metanorma_extension.rb +16 -0
- data/lib/metanorma/standard_document/metadata.rb +2 -0
- data/lib/metanorma/standard_document/refs/reference_to_term.rb +2 -1
- data/lib/metanorma/standard_document/root_attributes.rb +78 -0
- data/lib/metanorma/standard_document/sections/abstract.rb +1 -3
- data/lib/metanorma/standard_document/sections/acknowledgements.rb +1 -3
- data/lib/metanorma/standard_document/sections/annex_section.rb +81 -16
- data/lib/metanorma/standard_document/sections/bibliography_section.rb +1 -2
- data/lib/metanorma/standard_document/sections/clause_section.rb +102 -10
- data/lib/metanorma/standard_document/sections/colophon.rb +16 -0
- data/lib/metanorma/standard_document/sections/definition_section.rb +45 -42
- data/lib/metanorma/standard_document/sections/floating_section_title.rb +23 -0
- data/lib/metanorma/standard_document/sections/foreword.rb +1 -3
- data/lib/metanorma/standard_document/sections/introduction.rb +1 -4
- data/lib/metanorma/standard_document/sections/misc_container.rb +5 -2
- data/lib/metanorma/standard_document/sections/preface.rb +36 -0
- data/lib/metanorma/standard_document/sections/sections.rb +40 -0
- data/lib/metanorma/standard_document/sections/standard_content_section.rb +42 -9
- data/lib/metanorma/standard_document/sections/terms_section.rb +52 -10
- data/lib/metanorma/standard_document/sections.rb +6 -2
- data/lib/metanorma/standard_document/terms/designation.rb +1 -1
- data/lib/metanorma/standard_document/terms/term_expression.rb +51 -0
- data/lib/metanorma/standard_document/terms.rb +1 -0
- data/lib/metanorma/standard_document.rb +7 -2
- data/lib/metanorma/un_document/metadata/un_bib_data_extension_type.rb +10 -0
- data/lib/metanorma/un_document/metadata/un_bibliographic_item.rb +15 -0
- data/lib/metanorma/un_document/metadata.rb +12 -0
- data/lib/metanorma/un_document/root.rb +29 -0
- data/lib/metanorma/un_document/sections/un_preface.rb +23 -0
- data/lib/metanorma/un_document/sections/un_sections.rb +24 -0
- data/lib/metanorma/un_document/sections.rb +10 -0
- data/lib/metanorma/un_document.rb +11 -0
- metadata +77 -3
- data/lib/metanorma/html/whitespace_patch.rb +0 -47
|
@@ -1,165 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
attribute :tag, :string
|
|
22
|
-
attribute :value, ClassificationValue
|
|
23
|
-
|
|
24
|
-
xml do
|
|
25
|
-
element "classification"
|
|
26
|
-
map_element "tag", to: :tag
|
|
27
|
-
map_element "value", to: :value
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Description wrapper inside requirements containing paragraphs and other blocks.
|
|
32
|
-
class RequirementDescription < Lutaml::Model::Serializable
|
|
33
|
-
attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
34
|
-
collection: true
|
|
35
|
-
attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
|
|
36
|
-
collection: true
|
|
37
|
-
attribute :ol, Metanorma::Document::Components::Lists::OrderedList,
|
|
38
|
-
collection: true
|
|
39
|
-
attribute :sourcecode,
|
|
40
|
-
Metanorma::Document::Components::AncillaryBlocks::SourcecodeBlock,
|
|
41
|
-
collection: true
|
|
42
|
-
attribute :table, Metanorma::Document::Components::Tables::TableBlock,
|
|
43
|
-
collection: true
|
|
44
|
-
attribute :example,
|
|
45
|
-
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
46
|
-
collection: true
|
|
47
|
-
attribute :note, Metanorma::Document::Components::Blocks::NoteBlock,
|
|
48
|
-
collection: true
|
|
49
|
-
attribute :figure,
|
|
50
|
-
Metanorma::Document::Components::AncillaryBlocks::FigureBlock,
|
|
51
|
-
collection: true
|
|
52
|
-
|
|
53
|
-
xml do
|
|
54
|
-
element "description"
|
|
55
|
-
map_element "p", to: :p
|
|
56
|
-
map_element "ul", to: :ul
|
|
57
|
-
map_element "ol", to: :ol
|
|
58
|
-
map_element "sourcecode", to: :sourcecode
|
|
59
|
-
map_element "table", to: :table
|
|
60
|
-
map_element "example", to: :example
|
|
61
|
-
map_element "note", to: :note
|
|
62
|
-
map_element "figure", to: :figure
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# Inherit element — mixed content, can contain text, eref, or xref.
|
|
67
|
-
class RequirementInherit < Lutaml::Model::Serializable
|
|
68
|
-
attribute :text, :string, collection: true
|
|
69
|
-
attribute :eref, Metanorma::Document::Components::Inline::ErefElement,
|
|
70
|
-
collection: true
|
|
71
|
-
attribute :xref, Metanorma::Document::Components::Inline::XrefElement,
|
|
72
|
-
collection: true
|
|
73
|
-
|
|
74
|
-
xml do
|
|
75
|
-
mixed_content
|
|
76
|
-
map_content to: :text
|
|
77
|
-
map_element "eref", to: :eref
|
|
78
|
-
map_element "xref", to: :xref
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Base class for requirement/recommendation/permission with shared structure.
|
|
83
|
-
class RequirementBase < Lutaml::Model::Serializable
|
|
84
|
-
attribute :id, :string
|
|
85
|
-
attribute :model, :string
|
|
86
|
-
attribute :obligation, :string
|
|
87
|
-
attribute :type, :string
|
|
88
|
-
attribute :anchor, :string
|
|
89
|
-
attribute :subject, :string
|
|
90
|
-
attribute :classification, RequirementClassification, collection: true
|
|
91
|
-
attribute :description, RequirementDescription, collection: true
|
|
92
|
-
attribute :inherit, RequirementInherit, collection: true
|
|
93
|
-
attribute :requirement, "Metanorma::StandardDocument::Blocks::RequirementModel",
|
|
94
|
-
collection: true
|
|
95
|
-
attribute :recommendation, "Metanorma::StandardDocument::Blocks::RecommendationModel",
|
|
96
|
-
collection: true
|
|
97
|
-
attribute :permission, "Metanorma::StandardDocument::Blocks::PermissionModel",
|
|
98
|
-
collection: true
|
|
99
|
-
attribute :example,
|
|
100
|
-
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
101
|
-
collection: true
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
# Requirement element — prescriptive statement using "shall".
|
|
105
|
-
class RequirementModel < RequirementBase
|
|
106
|
-
xml do
|
|
107
|
-
element "requirement"
|
|
108
|
-
map_attribute "id", to: :id
|
|
109
|
-
map_attribute "model", to: :model
|
|
110
|
-
map_attribute "obligation", to: :obligation
|
|
111
|
-
map_attribute "type", to: :type
|
|
112
|
-
map_attribute "anchor", to: :anchor
|
|
113
|
-
map_element "subject", to: :subject
|
|
114
|
-
map_element "classification", to: :classification
|
|
115
|
-
map_element "description", to: :description
|
|
116
|
-
map_element "inherit", to: :inherit
|
|
117
|
-
map_element "requirement", to: :requirement
|
|
118
|
-
map_element "recommendation", to: :recommendation
|
|
119
|
-
map_element "permission", to: :permission
|
|
120
|
-
map_element "example", to: :example
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
# Recommendation element — prescriptive statement using "should".
|
|
125
|
-
class RecommendationModel < RequirementBase
|
|
126
|
-
xml do
|
|
127
|
-
element "recommendation"
|
|
128
|
-
map_attribute "id", to: :id
|
|
129
|
-
map_attribute "model", to: :model
|
|
130
|
-
map_attribute "obligation", to: :obligation
|
|
131
|
-
map_attribute "type", to: :type
|
|
132
|
-
map_attribute "anchor", to: :anchor
|
|
133
|
-
map_element "subject", to: :subject
|
|
134
|
-
map_element "classification", to: :classification
|
|
135
|
-
map_element "description", to: :description
|
|
136
|
-
map_element "inherit", to: :inherit
|
|
137
|
-
map_element "requirement", to: :requirement
|
|
138
|
-
map_element "recommendation", to: :recommendation
|
|
139
|
-
map_element "permission", to: :permission
|
|
140
|
-
map_element "example", to: :example
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# Permission element — prescriptive statement using "may".
|
|
145
|
-
class PermissionModel < RequirementBase
|
|
146
|
-
xml do
|
|
147
|
-
element "permission"
|
|
148
|
-
map_attribute "id", to: :id
|
|
149
|
-
map_attribute "model", to: :model
|
|
150
|
-
map_attribute "obligation", to: :obligation
|
|
151
|
-
map_attribute "type", to: :type
|
|
152
|
-
map_attribute "anchor", to: :anchor
|
|
153
|
-
map_element "subject", to: :subject
|
|
154
|
-
map_element "classification", to: :classification
|
|
155
|
-
map_element "description", to: :description
|
|
156
|
-
map_element "inherit", to: :inherit
|
|
157
|
-
map_element "requirement", to: :requirement
|
|
158
|
-
map_element "recommendation", to: :recommendation
|
|
159
|
-
map_element "permission", to: :permission
|
|
160
|
-
map_element "example", to: :example
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
end
|
|
3
|
+
DOC = Metanorma::Document::Components::Blocks
|
|
4
|
+
|
|
5
|
+
Metanorma::StandardDocument::Blocks::ClassificationValue =
|
|
6
|
+
DOC::ClassificationValue
|
|
7
|
+
Metanorma::StandardDocument::Blocks::RequirementClassification =
|
|
8
|
+
DOC::RequirementClassification
|
|
9
|
+
Metanorma::StandardDocument::Blocks::RequirementDescription =
|
|
10
|
+
DOC::RequirementDescription
|
|
11
|
+
Metanorma::StandardDocument::Blocks::RequirementInherit =
|
|
12
|
+
DOC::RequirementInherit
|
|
13
|
+
Metanorma::StandardDocument::Blocks::RequirementBase =
|
|
14
|
+
DOC::RequirementBase
|
|
15
|
+
Metanorma::StandardDocument::Blocks::RequirementModel =
|
|
16
|
+
DOC::RequirementModel
|
|
17
|
+
Metanorma::StandardDocument::Blocks::RecommendationModel =
|
|
18
|
+
DOC::RecommendationModel
|
|
19
|
+
Metanorma::StandardDocument::Blocks::PermissionModel =
|
|
20
|
+
DOC::PermissionModel
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
module StandardDocument
|
|
5
|
-
module Elements
|
|
6
|
-
# Indication of text added through editorial intervention.
|
|
7
|
-
class Add < Metanorma::Document::Components::TextElements::TextElement
|
|
8
|
-
attribute :semx_id, :string
|
|
9
|
-
attribute :original_id, :string
|
|
10
|
-
xml do
|
|
11
|
-
element "add"
|
|
12
|
-
|
|
13
|
-
map_attribute "semx-id", to: :semx_id
|
|
14
|
-
map_attribute "original-id", to: :original_id
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
3
|
+
Metanorma::StandardDocument::Elements::Add = Metanorma::Document::Elements::Add
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
module StandardDocument
|
|
5
|
-
module Elements
|
|
6
|
-
# Indication of text deleted through editorial intervention.
|
|
7
|
-
class Del < Metanorma::Document::Components::TextElements::TextElement
|
|
8
|
-
attribute :semx_id, :string
|
|
9
|
-
attribute :original_id, :string
|
|
10
|
-
xml do
|
|
11
|
-
element "del"
|
|
12
|
-
|
|
13
|
-
map_attribute "semx-id", to: :semx_id
|
|
14
|
-
map_attribute "original-id", to: :original_id
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
3
|
+
Metanorma::StandardDocument::Elements::Del = Metanorma::Document::Elements::Del
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module StandardDocument
|
|
5
|
+
module Metadata
|
|
6
|
+
class MetanormaExtension < Lutaml::Model::Serializable
|
|
7
|
+
attribute :content, :string
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
element "metanorma-extension"
|
|
11
|
+
map_all_content to: :content
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -5,6 +5,8 @@ module Metanorma
|
|
|
5
5
|
module Metadata
|
|
6
6
|
autoload :EditorialGroupType, "#{__dir__}/metadata/editorial_group_type"
|
|
7
7
|
autoload :IcsType, "#{__dir__}/metadata/ics_type"
|
|
8
|
+
autoload :MetanormaExtension,
|
|
9
|
+
"#{__dir__}/metadata/metanorma_extension"
|
|
8
10
|
autoload :StandardBibData, "#{__dir__}/metadata/standard_bib_data"
|
|
9
11
|
autoload :StandardBibDataExtensionType,
|
|
10
12
|
"#{__dir__}/metadata/standard_bib_data_extension_type"
|
|
@@ -5,7 +5,8 @@ module Metanorma
|
|
|
5
5
|
module Refs
|
|
6
6
|
# Cross-reference to a term.
|
|
7
7
|
class ReferenceToTerm < Metanorma::Document::Components::ReferenceElements::ReferenceElement
|
|
8
|
-
attribute :source,
|
|
8
|
+
attribute :source,
|
|
9
|
+
Metanorma::Document::Components::ReferenceElements::SourceElement
|
|
9
10
|
attribute :term, :string, collection: true
|
|
10
11
|
|
|
11
12
|
attribute :semx_id, :string
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module StandardDocument
|
|
5
|
+
# Mixin that declares the common attributes for every <metanorma> Root class.
|
|
6
|
+
#
|
|
7
|
+
# Every flavor Root class includes this module and adds its own
|
|
8
|
+
# flavor-specific attributes (e.g. bibdata type, preface/sections types).
|
|
9
|
+
module RootAttributes
|
|
10
|
+
def self.included(base)
|
|
11
|
+
base.class_eval do
|
|
12
|
+
attribute :version, :string
|
|
13
|
+
attribute :type, :string
|
|
14
|
+
attribute :schema_version, :string
|
|
15
|
+
attribute :flavor, :string
|
|
16
|
+
|
|
17
|
+
attribute :bibliography,
|
|
18
|
+
Metanorma::StandardDocument::Sections::BibliographySection
|
|
19
|
+
attribute :boilerplate,
|
|
20
|
+
Metanorma::StandardDocument::Boilerplate
|
|
21
|
+
attribute :metanorma_extension,
|
|
22
|
+
Metanorma::StandardDocument::Metadata::MetanormaExtension
|
|
23
|
+
attribute :annotation_container,
|
|
24
|
+
Metanorma::StandardDocument::AnnotationContainer
|
|
25
|
+
attribute :localized_strings,
|
|
26
|
+
Metanorma::Document::Components::Inline::LocalizedStringsElement
|
|
27
|
+
attribute :fmt_footnote_container,
|
|
28
|
+
Metanorma::Document::Components::Inline::FmtFootnoteContainerElement
|
|
29
|
+
attribute :colophon,
|
|
30
|
+
Metanorma::StandardDocument::Sections::Colophon
|
|
31
|
+
|
|
32
|
+
attribute :term_sources,
|
|
33
|
+
Metanorma::Document::Components::ReferenceElements::Citation,
|
|
34
|
+
collection: true
|
|
35
|
+
attribute :indexsect,
|
|
36
|
+
Metanorma::Document::Components::Sections::BasicSection
|
|
37
|
+
|
|
38
|
+
attribute :autonum, :string
|
|
39
|
+
attribute :fmt_xref_label, :string
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Adds common XML root element mappings for all flavor Root classes.
|
|
45
|
+
# Call inside an `xml do` block:
|
|
46
|
+
#
|
|
47
|
+
# xml do
|
|
48
|
+
# element "metanorma"
|
|
49
|
+
# namespace StandardDocument::Namespace
|
|
50
|
+
# RootXmlMapping.apply(self)
|
|
51
|
+
# # ... flavor-specific mappings (bibdata, preface, sections, annex)
|
|
52
|
+
# end
|
|
53
|
+
module RootXmlMapping
|
|
54
|
+
def self.apply(mapping)
|
|
55
|
+
mapping.map_attribute "type", to: :type
|
|
56
|
+
mapping.map_attribute "version", to: :version
|
|
57
|
+
mapping.map_attribute "schema-version", to: :schema_version
|
|
58
|
+
mapping.map_attribute "flavor", to: :flavor
|
|
59
|
+
mapping.map_attribute "autonum", to: :autonum
|
|
60
|
+
mapping.map_attribute "fmt-xref-label", to: :fmt_xref_label
|
|
61
|
+
mapping.map_element "bibdata", to: :bibdata
|
|
62
|
+
mapping.map_element "preface", to: :preface
|
|
63
|
+
mapping.map_element "sections", to: :sections
|
|
64
|
+
mapping.map_element "annex", to: :annex
|
|
65
|
+
mapping.map_element "bibliography", to: :bibliography
|
|
66
|
+
mapping.map_element "boilerplate", to: :boilerplate
|
|
67
|
+
mapping.map_element "metanorma-extension", to: :metanorma_extension
|
|
68
|
+
mapping.map_element "annotation-container", to: :annotation_container
|
|
69
|
+
mapping.map_element "localized-strings", to: :localized_strings
|
|
70
|
+
mapping.map_element "fmt-footnote-container",
|
|
71
|
+
to: :fmt_footnote_container
|
|
72
|
+
mapping.map_element "colophon", to: :colophon
|
|
73
|
+
mapping.map_element "termdocsource", to: :term_sources
|
|
74
|
+
mapping.map_element "indexsect", to: :indexsect
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -4,10 +4,8 @@ module Metanorma
|
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
6
|
# Abstract of the document.
|
|
7
|
-
class Abstract < Metanorma::StandardDocument::Sections::
|
|
8
|
-
attribute :semx_id, :string
|
|
7
|
+
class Abstract < Metanorma::StandardDocument::Sections::ContentSection
|
|
9
8
|
attribute :original_id, :string
|
|
10
|
-
attribute :displayorder, :integer
|
|
11
9
|
xml do
|
|
12
10
|
element "abstract"
|
|
13
11
|
|
|
@@ -4,10 +4,8 @@ module Metanorma
|
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
6
|
# Acknowledgements for the document.
|
|
7
|
-
class Acknowledgements < Metanorma::StandardDocument::Sections::
|
|
8
|
-
attribute :semx_id, :string
|
|
7
|
+
class Acknowledgements < Metanorma::StandardDocument::Sections::ContentSection
|
|
9
8
|
attribute :original_id, :string
|
|
10
|
-
attribute :displayorder, :integer
|
|
11
9
|
xml do
|
|
12
10
|
element "acknowledgements"
|
|
13
11
|
|
|
@@ -3,28 +3,93 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
# An annex section in the document.
|
|
7
|
+
# Corresponds to isodoc.rnc `Annex-Section-Body`:
|
|
8
|
+
# Annex-Section-Attributes, title?,
|
|
9
|
+
# ( BasicBlock*,
|
|
10
|
+
# (annex-subsection | terms | definitions | references | floating-title)* )
|
|
11
|
+
#
|
|
12
|
+
# Uses `ordered` to enable `each_mixed_content` for document-order iteration.
|
|
13
|
+
class AnnexSection < Lutaml::Model::Serializable
|
|
14
|
+
include Metanorma::StandardDocument::BlockAttributes
|
|
10
15
|
|
|
16
|
+
# Section identity and classification
|
|
17
|
+
attribute :id, :string
|
|
18
|
+
attribute :number, :string
|
|
19
|
+
attribute :obligation, :string
|
|
20
|
+
attribute :unnumbered, :string
|
|
21
|
+
attribute :toc, :string
|
|
22
|
+
attribute :inline_header, :string
|
|
23
|
+
attribute :title,
|
|
24
|
+
Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
25
|
+
|
|
26
|
+
# Sub-clauses within annex (recursive)
|
|
27
|
+
attribute :clause, AnnexSection, collection: true
|
|
28
|
+
|
|
29
|
+
# Appendix (sub-sections unique to annex)
|
|
30
|
+
attribute :appendix, ClauseSection, collection: true
|
|
31
|
+
|
|
32
|
+
# Terms, definitions, references within annex
|
|
33
|
+
attribute :terms,
|
|
34
|
+
Metanorma::StandardDocument::Sections::TermsSection,
|
|
35
|
+
collection: true
|
|
36
|
+
attribute :definitions,
|
|
37
|
+
Metanorma::StandardDocument::Sections::DefinitionSection,
|
|
38
|
+
collection: true
|
|
39
|
+
attribute :references,
|
|
40
|
+
Metanorma::StandardDocument::Sections::StandardReferencesSection,
|
|
41
|
+
collection: true
|
|
42
|
+
|
|
43
|
+
# Floating titles
|
|
44
|
+
attribute :floating_title,
|
|
45
|
+
Metanorma::StandardDocument::Sections::FloatingTitle,
|
|
46
|
+
collection: true
|
|
47
|
+
|
|
48
|
+
# Page breaks
|
|
49
|
+
attribute :pagebreak,
|
|
50
|
+
Metanorma::Document::Components::EmptyElements::PageBreakElement,
|
|
51
|
+
collection: true
|
|
52
|
+
|
|
53
|
+
# Presentation-specific attributes
|
|
54
|
+
attribute :anchor, :string
|
|
11
55
|
attribute :semx_id, :string
|
|
12
|
-
attribute :original_id, :string
|
|
13
56
|
attribute :autonum, :string
|
|
14
57
|
attribute :displayorder, :integer
|
|
15
|
-
attribute :
|
|
16
|
-
attribute :
|
|
58
|
+
attribute :language, :string
|
|
59
|
+
attribute :script, :string
|
|
60
|
+
attribute :fmt_title,
|
|
61
|
+
Metanorma::Document::Components::Inline::FmtTitleElement
|
|
62
|
+
attribute :fmt_xref_label,
|
|
63
|
+
Metanorma::Document::Components::Inline::FmtXrefLabelElement,
|
|
64
|
+
collection: true
|
|
65
|
+
attribute :variant_title,
|
|
66
|
+
Metanorma::Document::Components::Inline::VariantTitleElement,
|
|
67
|
+
collection: true
|
|
68
|
+
attribute :fmt_annotation_start,
|
|
69
|
+
Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
|
|
70
|
+
collection: true
|
|
71
|
+
attribute :fmt_annotation_end,
|
|
72
|
+
Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
|
|
73
|
+
collection: true
|
|
17
74
|
|
|
18
75
|
xml do
|
|
19
|
-
element "annex
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
76
|
+
element "annex"
|
|
77
|
+
ordered
|
|
78
|
+
|
|
79
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_annex_attributes(self)
|
|
80
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_annex_elements(self)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Blocks in document order, used by JSON serialization
|
|
84
|
+
def blocks
|
|
85
|
+
@blocks ||=
|
|
86
|
+
begin
|
|
87
|
+
result = []
|
|
88
|
+
each_mixed_content do |node|
|
|
89
|
+
result << node unless node.is_a?(String)
|
|
90
|
+
end
|
|
91
|
+
result
|
|
92
|
+
end
|
|
28
93
|
end
|
|
29
94
|
end
|
|
30
95
|
end
|
|
@@ -7,8 +7,7 @@ module Metanorma
|
|
|
7
7
|
# one or more <references> sections (normative and/or informative).
|
|
8
8
|
class BibliographySection < Lutaml::Model::Serializable
|
|
9
9
|
attribute :references, StandardReferencesSection, collection: true
|
|
10
|
-
attribute :clause,
|
|
11
|
-
collection: true
|
|
10
|
+
attribute :clause, ClauseSection, collection: true
|
|
12
11
|
|
|
13
12
|
xml do
|
|
14
13
|
element "bibliography"
|
|
@@ -3,25 +3,117 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
|
-
# A numbered clause
|
|
7
|
-
|
|
6
|
+
# A numbered clause in the document body.
|
|
7
|
+
# Corresponds to isodoc.rnc `Clause-Section`:
|
|
8
|
+
# Section-Attributes, type?, title?,
|
|
9
|
+
# ( (BasicBlock+ | amend) |
|
|
10
|
+
# (clause-subsection | terms | definitions | floating-title)+ )
|
|
11
|
+
#
|
|
12
|
+
# Uses `ordered` to enable `each_mixed_content` for document-order iteration.
|
|
13
|
+
class ClauseSection < Lutaml::Model::Serializable
|
|
14
|
+
include Metanorma::StandardDocument::BlockAttributes
|
|
15
|
+
|
|
16
|
+
# Section identity and classification
|
|
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
|
|
27
|
+
|
|
28
|
+
# Sub-clauses (recursive)
|
|
29
|
+
attribute :clause, ClauseSection, collection: true
|
|
30
|
+
|
|
31
|
+
# Amend blocks (for amendment documents)
|
|
32
|
+
attribute :amend,
|
|
33
|
+
Metanorma::StandardDocument::Blocks::AmendBlock
|
|
34
|
+
|
|
35
|
+
# Terms sections nested inside clauses
|
|
36
|
+
attribute :terms,
|
|
37
|
+
Metanorma::StandardDocument::Sections::TermsSection,
|
|
38
|
+
collection: true
|
|
39
|
+
|
|
40
|
+
# Definitions sections nested inside clauses
|
|
41
|
+
attribute :definitions,
|
|
42
|
+
Metanorma::StandardDocument::Sections::DefinitionSection,
|
|
43
|
+
collection: true
|
|
44
|
+
|
|
45
|
+
# References sections nested inside clauses
|
|
46
|
+
attribute :references,
|
|
47
|
+
Metanorma::StandardDocument::Sections::StandardReferencesSection,
|
|
48
|
+
collection: true
|
|
9
49
|
|
|
50
|
+
# Floating titles
|
|
51
|
+
attribute :floating_title,
|
|
52
|
+
Metanorma::StandardDocument::Sections::FloatingTitle,
|
|
53
|
+
collection: true
|
|
54
|
+
|
|
55
|
+
# Forms
|
|
56
|
+
attribute :form,
|
|
57
|
+
Metanorma::StandardDocument::Blocks::Form,
|
|
58
|
+
collection: true
|
|
59
|
+
|
|
60
|
+
# Requirements / recommendations / permissions
|
|
61
|
+
attribute :requirement,
|
|
62
|
+
Metanorma::StandardDocument::Blocks::RequirementModel,
|
|
63
|
+
collection: true
|
|
64
|
+
attribute :recommendation,
|
|
65
|
+
Metanorma::StandardDocument::Blocks::RecommendationModel,
|
|
66
|
+
collection: true
|
|
67
|
+
attribute :permission,
|
|
68
|
+
Metanorma::StandardDocument::Blocks::PermissionModel,
|
|
69
|
+
collection: true
|
|
70
|
+
|
|
71
|
+
# Page breaks and bookmarks
|
|
72
|
+
attribute :pagebreak,
|
|
73
|
+
Metanorma::Document::Components::EmptyElements::PageBreakElement,
|
|
74
|
+
collection: true
|
|
75
|
+
attribute :bookmark,
|
|
76
|
+
Metanorma::Document::Components::IdElements::Bookmark,
|
|
77
|
+
collection: true
|
|
78
|
+
|
|
79
|
+
# Presentation-specific attributes
|
|
80
|
+
attribute :anchor, :string
|
|
10
81
|
attribute :semx_id, :string
|
|
11
|
-
attribute :original_id, :string
|
|
12
82
|
attribute :autonum, :string
|
|
13
83
|
attribute :displayorder, :integer
|
|
14
|
-
attribute :
|
|
84
|
+
attribute :fmt_title,
|
|
85
|
+
Metanorma::Document::Components::Inline::FmtTitleElement
|
|
86
|
+
attribute :fmt_xref_label,
|
|
87
|
+
Metanorma::Document::Components::Inline::FmtXrefLabelElement,
|
|
88
|
+
collection: true
|
|
89
|
+
attribute :variant_title,
|
|
90
|
+
Metanorma::Document::Components::Inline::VariantTitleElement,
|
|
91
|
+
collection: true
|
|
92
|
+
attribute :fmt_annotation_start,
|
|
93
|
+
Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
|
|
94
|
+
collection: true
|
|
95
|
+
attribute :fmt_annotation_end,
|
|
96
|
+
Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
|
|
97
|
+
collection: true
|
|
15
98
|
|
|
16
99
|
xml do
|
|
17
100
|
element "clause"
|
|
18
|
-
|
|
101
|
+
ordered
|
|
102
|
+
|
|
103
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_clause_attributes(self)
|
|
104
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_clause_elements(self)
|
|
105
|
+
end
|
|
19
106
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
107
|
+
# Blocks in document order, used by JSON serialization
|
|
108
|
+
def blocks
|
|
109
|
+
@blocks ||=
|
|
110
|
+
begin
|
|
111
|
+
result = []
|
|
112
|
+
each_mixed_content do |node|
|
|
113
|
+
result << node unless node.is_a?(String)
|
|
114
|
+
end
|
|
115
|
+
result
|
|
116
|
+
end
|
|
25
117
|
end
|
|
26
118
|
end
|
|
27
119
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module StandardDocument
|
|
5
|
+
module Sections
|
|
6
|
+
class Colophon < Lutaml::Model::Serializable
|
|
7
|
+
attribute :clause, ClauseSection, collection: true
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
element "colophon"
|
|
11
|
+
map_element "clause", to: :clause
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|