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
|
@@ -4,179 +4,22 @@ module Metanorma
|
|
|
4
4
|
module IsoDocument
|
|
5
5
|
module Sections
|
|
6
6
|
# A numbered clause in an ISO/IEC document body.
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
attribute :number, :string
|
|
13
|
-
attribute :obligation, :string
|
|
14
|
-
attribute :inline_header, :string
|
|
15
|
-
attribute :unnumbered, :string
|
|
16
|
-
attribute :toc, :string
|
|
17
|
-
attribute :class_attr, :string
|
|
18
|
-
attribute :title, Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
19
|
-
|
|
20
|
-
# Sub-clauses (recursive)
|
|
7
|
+
# Extends StandardDocument::ClauseSection with ISO-specific overrides:
|
|
8
|
+
# - Recursive clauses are IsoClauseSection (not ClauseSection)
|
|
9
|
+
# - Terms sections are IsoTermsSection (not TermsSection)
|
|
10
|
+
class IsoClauseSection < Metanorma::StandardDocument::Sections::ClauseSection
|
|
11
|
+
# Override: ISO sub-clauses are IsoClauseSection
|
|
21
12
|
attribute :clause, IsoClauseSection, collection: true
|
|
22
13
|
|
|
23
|
-
#
|
|
24
|
-
attribute :
|
|
25
|
-
Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
26
|
-
collection: true
|
|
27
|
-
attribute :unordered_lists,
|
|
28
|
-
Metanorma::Document::Components::Lists::UnorderedList,
|
|
29
|
-
collection: true
|
|
30
|
-
attribute :ordered_lists,
|
|
31
|
-
Metanorma::Document::Components::Lists::OrderedList,
|
|
32
|
-
collection: true
|
|
33
|
-
attribute :tables,
|
|
34
|
-
Metanorma::Document::Components::Tables::TableBlock,
|
|
35
|
-
collection: true
|
|
36
|
-
attribute :figures,
|
|
37
|
-
Metanorma::Document::Components::AncillaryBlocks::FigureBlock,
|
|
38
|
-
collection: true
|
|
39
|
-
attribute :formulas,
|
|
40
|
-
Metanorma::Document::Components::AncillaryBlocks::FormulaBlock,
|
|
41
|
-
collection: true
|
|
42
|
-
attribute :examples,
|
|
43
|
-
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
44
|
-
collection: true
|
|
45
|
-
attribute :notes,
|
|
46
|
-
Metanorma::Document::Components::Blocks::NoteBlock,
|
|
47
|
-
collection: true
|
|
48
|
-
attribute :admonitions,
|
|
49
|
-
Metanorma::Document::Components::MultiParagraph::AdmonitionBlock,
|
|
50
|
-
collection: true
|
|
51
|
-
attribute :sourcecode_blocks,
|
|
52
|
-
Metanorma::Document::Components::AncillaryBlocks::SourcecodeBlock,
|
|
53
|
-
collection: true
|
|
54
|
-
attribute :quote_blocks,
|
|
55
|
-
Metanorma::Document::Components::MultiParagraph::QuoteBlock,
|
|
56
|
-
collection: true
|
|
57
|
-
attribute :definition_lists,
|
|
58
|
-
Metanorma::Document::Components::Lists::DefinitionList,
|
|
59
|
-
collection: true
|
|
60
|
-
|
|
61
|
-
# Amend blocks (for amendment documents)
|
|
62
|
-
attribute :amend,
|
|
63
|
-
Metanorma::StandardDocument::Blocks::AmendBlock
|
|
64
|
-
|
|
65
|
-
# Terms sections nested inside clauses
|
|
66
|
-
attribute :terms,
|
|
67
|
-
IsoTermsSection, collection: true
|
|
68
|
-
|
|
69
|
-
# Definitions sections nested inside clauses
|
|
70
|
-
attribute :definitions,
|
|
71
|
-
Metanorma::StandardDocument::Sections::DefinitionSection,
|
|
72
|
-
collection: true
|
|
73
|
-
|
|
74
|
-
# References sections nested inside clauses
|
|
75
|
-
attribute :references,
|
|
76
|
-
Metanorma::StandardDocument::Sections::StandardReferencesSection,
|
|
77
|
-
collection: true
|
|
78
|
-
|
|
79
|
-
# Forms (HTML input forms with tables)
|
|
80
|
-
attribute :form,
|
|
81
|
-
Metanorma::StandardDocument::Blocks::Form,
|
|
82
|
-
collection: true
|
|
83
|
-
|
|
84
|
-
# Requirements / recommendations / permissions
|
|
85
|
-
attribute :requirement,
|
|
86
|
-
Metanorma::StandardDocument::Blocks::RequirementModel,
|
|
87
|
-
collection: true
|
|
88
|
-
attribute :recommendation,
|
|
89
|
-
Metanorma::StandardDocument::Blocks::RecommendationModel,
|
|
90
|
-
collection: true
|
|
91
|
-
attribute :permission,
|
|
92
|
-
Metanorma::StandardDocument::Blocks::PermissionModel,
|
|
93
|
-
collection: true
|
|
94
|
-
|
|
95
|
-
# Page breaks
|
|
96
|
-
attribute :pagebreak,
|
|
97
|
-
Metanorma::Document::Components::EmptyElements::PageBreakElement,
|
|
98
|
-
collection: true
|
|
99
|
-
|
|
100
|
-
# Bookmarks (inline anchors)
|
|
101
|
-
attribute :bookmark,
|
|
102
|
-
Metanorma::Document::Components::IdElements::Bookmark,
|
|
103
|
-
collection: true
|
|
104
|
-
|
|
105
|
-
# Presentation annotation markers
|
|
106
|
-
attribute :fmt_annotation_start,
|
|
107
|
-
Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
|
|
108
|
-
collection: true
|
|
109
|
-
attribute :fmt_annotation_end,
|
|
110
|
-
Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
|
|
111
|
-
collection: true
|
|
112
|
-
|
|
113
|
-
# Presentation-specific attributes
|
|
114
|
-
attribute :anchor, :string
|
|
115
|
-
attribute :semx_id, :string
|
|
116
|
-
attribute :autonum, :string
|
|
117
|
-
attribute :displayorder, :integer
|
|
118
|
-
attribute :fmt_title, Metanorma::Document::Components::Inline::FmtTitleElement
|
|
119
|
-
attribute :fmt_xref_label, Metanorma::Document::Components::Inline::FmtXrefLabelElement,
|
|
120
|
-
collection: true
|
|
121
|
-
attribute :variant_title,
|
|
122
|
-
Metanorma::Document::Components::Inline::VariantTitleElement, collection: true
|
|
14
|
+
# Override: ISO terms sections use IsoTermsSection
|
|
15
|
+
attribute :terms, IsoTermsSection, collection: true
|
|
123
16
|
|
|
124
17
|
xml do
|
|
125
18
|
element "clause"
|
|
126
19
|
ordered
|
|
127
|
-
map_attribute "id", to: :id
|
|
128
|
-
map_attribute "anchor", to: :anchor
|
|
129
|
-
map_attribute "type", to: :type
|
|
130
|
-
map_attribute "number", to: :number
|
|
131
|
-
map_attribute "obligation", to: :obligation
|
|
132
|
-
map_attribute "inline-header", to: :inline_header
|
|
133
|
-
map_attribute "unnumbered", to: :unnumbered
|
|
134
|
-
map_attribute "toc", to: :toc
|
|
135
|
-
map_attribute "class", to: :class_attr
|
|
136
|
-
map_element "title", to: :title
|
|
137
|
-
map_element "variant-title", to: :variant_title
|
|
138
|
-
map_element "fmt-title", to: :fmt_title
|
|
139
|
-
map_element "fmt-xref-label", to: :fmt_xref_label
|
|
140
|
-
map_element "clause", to: :clause
|
|
141
|
-
map_element "p", to: :paragraphs
|
|
142
|
-
map_element "ul", to: :unordered_lists
|
|
143
|
-
map_element "ol", to: :ordered_lists
|
|
144
|
-
map_element "table", to: :tables
|
|
145
|
-
map_element "figure", to: :figures
|
|
146
|
-
map_element "formula", to: :formulas
|
|
147
|
-
map_element "example", to: :examples
|
|
148
|
-
map_element "note", to: :notes
|
|
149
|
-
map_element "admonition", to: :admonitions
|
|
150
|
-
map_element "sourcecode", to: :sourcecode_blocks
|
|
151
|
-
map_element "quote", to: :quote_blocks
|
|
152
|
-
map_element "dl", to: :definition_lists
|
|
153
|
-
map_element "amend", to: :amend
|
|
154
|
-
map_element "terms", to: :terms
|
|
155
|
-
map_element "definitions", to: :definitions
|
|
156
|
-
map_element "references", to: :references
|
|
157
|
-
map_element "form", to: :form
|
|
158
|
-
map_element "requirement", to: :requirement
|
|
159
|
-
map_element "recommendation", to: :recommendation
|
|
160
|
-
map_element "permission", to: :permission
|
|
161
|
-
map_element "pagebreak", to: :pagebreak
|
|
162
|
-
map_element "bookmark", to: :bookmark
|
|
163
|
-
map_element "fmt-annotation-start", to: :fmt_annotation_start
|
|
164
|
-
map_element "fmt-annotation-end", to: :fmt_annotation_end
|
|
165
|
-
map_attribute "semx-id", to: :semx_id
|
|
166
|
-
map_attribute "autonum", to: :autonum
|
|
167
|
-
map_attribute "displayorder", to: :displayorder
|
|
168
|
-
end
|
|
169
20
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
@blocks ||=
|
|
173
|
-
begin
|
|
174
|
-
result = []
|
|
175
|
-
each_mixed_content do |node|
|
|
176
|
-
result << node unless node.is_a?(String)
|
|
177
|
-
end
|
|
178
|
-
result
|
|
179
|
-
end
|
|
21
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_clause_attributes(self)
|
|
22
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_clause_elements(self)
|
|
180
23
|
end
|
|
181
24
|
|
|
182
25
|
json do
|
|
@@ -4,100 +4,26 @@ module Metanorma
|
|
|
4
4
|
module IsoDocument
|
|
5
5
|
module Sections
|
|
6
6
|
# Foreword section of an ISO/IEC document.
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
class IsoForewordSection <
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
# Extends ContentSection (blocks + optional subsections) but maps to
|
|
8
|
+
# the "foreword" element. ISO foreword typically has no subsections.
|
|
9
|
+
class IsoForewordSection < Metanorma::StandardDocument::Sections::ContentSection
|
|
10
|
+
xml do
|
|
11
|
+
element "foreword"
|
|
12
|
+
ordered
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
map_attribute "id", to: :id
|
|
15
|
+
map_attribute "anchor", to: :anchor
|
|
16
|
+
map_attribute "obligation", to: :obligation
|
|
17
|
+
map_attribute "semx-id", to: :semx_id
|
|
18
|
+
map_attribute "displayorder", to: :displayorder
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
19
|
-
collection: true
|
|
20
|
-
attribute :unordered_lists,
|
|
21
|
-
Metanorma::Document::Components::Lists::UnorderedList,
|
|
22
|
-
collection: true
|
|
23
|
-
attribute :ordered_lists,
|
|
24
|
-
Metanorma::Document::Components::Lists::OrderedList,
|
|
25
|
-
collection: true
|
|
26
|
-
attribute :tables,
|
|
27
|
-
Metanorma::Document::Components::Tables::TableBlock,
|
|
28
|
-
collection: true
|
|
29
|
-
attribute :figures,
|
|
30
|
-
Metanorma::Document::Components::AncillaryBlocks::FigureBlock,
|
|
31
|
-
collection: true
|
|
32
|
-
attribute :formulas,
|
|
33
|
-
Metanorma::Document::Components::AncillaryBlocks::FormulaBlock,
|
|
34
|
-
collection: true
|
|
35
|
-
attribute :examples,
|
|
36
|
-
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
37
|
-
collection: true
|
|
38
|
-
attribute :notes,
|
|
39
|
-
Metanorma::Document::Components::Blocks::NoteBlock,
|
|
40
|
-
collection: true
|
|
41
|
-
attribute :admonitions,
|
|
42
|
-
Metanorma::Document::Components::MultiParagraph::AdmonitionBlock,
|
|
43
|
-
collection: true
|
|
44
|
-
attribute :sourcecode_blocks,
|
|
45
|
-
Metanorma::Document::Components::AncillaryBlocks::SourcecodeBlock,
|
|
46
|
-
collection: true
|
|
47
|
-
attribute :definition_lists,
|
|
48
|
-
Metanorma::Document::Components::Lists::DefinitionList,
|
|
49
|
-
collection: true
|
|
50
|
-
attribute :quote_blocks,
|
|
51
|
-
Metanorma::Document::Components::MultiParagraph::QuoteBlock,
|
|
52
|
-
collection: true
|
|
20
|
+
map_element "title", to: :title
|
|
21
|
+
map_element "fmt-title", to: :fmt_title
|
|
53
22
|
|
|
54
|
-
|
|
55
|
-
attribute :anchor, :string
|
|
56
|
-
attribute :obligation, :string
|
|
57
|
-
attribute :semx_id, :string
|
|
58
|
-
attribute :displayorder, :integer
|
|
59
|
-
attribute :fmt_title, Metanorma::Document::Components::Inline::FmtTitleElement
|
|
60
|
-
attribute :fmt_annotation_start,
|
|
61
|
-
Metanorma::Document::Components::Inline::FmtAnnotationStartElement, collection: true
|
|
62
|
-
attribute :fmt_annotation_end,
|
|
63
|
-
Metanorma::Document::Components::Inline::FmtAnnotationEndElement, collection: true
|
|
23
|
+
Metanorma::StandardDocument::BlockXmlMapping.apply_block_mappings(self)
|
|
64
24
|
|
|
65
|
-
xml do
|
|
66
|
-
element "foreword"
|
|
67
|
-
ordered
|
|
68
|
-
map_attribute "id", to: :id
|
|
69
|
-
map_attribute "anchor", to: :anchor
|
|
70
|
-
map_attribute "obligation", to: :obligation
|
|
71
|
-
map_element "title", to: :title
|
|
72
|
-
map_element "fmt-title", to: :fmt_title
|
|
73
|
-
map_element "p", to: :paragraphs
|
|
74
|
-
map_element "ul", to: :unordered_lists
|
|
75
|
-
map_element "ol", to: :ordered_lists
|
|
76
|
-
map_element "table", to: :tables
|
|
77
|
-
map_element "figure", to: :figures
|
|
78
|
-
map_element "formula", to: :formulas
|
|
79
|
-
map_element "example", to: :examples
|
|
80
|
-
map_element "note", to: :notes
|
|
81
|
-
map_element "admonition", to: :admonitions
|
|
82
|
-
map_element "sourcecode", to: :sourcecode_blocks
|
|
83
|
-
map_element "dl", to: :definition_lists
|
|
84
|
-
map_element "quote", to: :quote_blocks
|
|
85
|
-
map_attribute "semx-id", to: :semx_id
|
|
86
|
-
map_attribute "displayorder", to: :displayorder
|
|
87
25
|
map_element "fmt-annotation-start", to: :fmt_annotation_start
|
|
88
|
-
map_element "fmt-annotation-end",
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Blocks in document order, used by JSON serialization
|
|
92
|
-
def blocks
|
|
93
|
-
@blocks ||=
|
|
94
|
-
begin
|
|
95
|
-
result = []
|
|
96
|
-
each_mixed_content do |node|
|
|
97
|
-
result << node unless node.is_a?(String)
|
|
98
|
-
end
|
|
99
|
-
result
|
|
100
|
-
end
|
|
26
|
+
map_element "fmt-annotation-end", to: :fmt_annotation_end
|
|
101
27
|
end
|
|
102
28
|
|
|
103
29
|
json do
|
|
@@ -3,39 +3,33 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module IsoDocument
|
|
5
5
|
module Sections
|
|
6
|
-
# Prefatory clauses
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
# Prefatory clauses in an ISO/IEC document.
|
|
7
|
+
# Extends StandardDocument::Preface with ISO-specific section types:
|
|
8
|
+
# abstract → IsoAbstractSection
|
|
9
|
+
# foreword → IsoForewordSection
|
|
10
|
+
# introduction → IsoClauseSection
|
|
11
|
+
# ISO preface mandates foreword; isodoc preface is permissive.
|
|
12
|
+
class IsoPreface < Metanorma::StandardDocument::Sections::Preface
|
|
13
|
+
# Override: ISO uses specific section types
|
|
9
14
|
attribute :abstract, IsoAbstractSection
|
|
10
|
-
|
|
11
|
-
# Foreword.
|
|
12
15
|
attribute :foreword, IsoForewordSection
|
|
13
|
-
|
|
14
|
-
# Introduction.
|
|
15
16
|
attribute :introduction, IsoClauseSection
|
|
16
17
|
|
|
17
|
-
#
|
|
18
|
+
# Generic clauses in preface use IsoClauseSection
|
|
18
19
|
attribute :clause, IsoClauseSection, collection: true
|
|
19
20
|
|
|
20
|
-
# Acknowledgements
|
|
21
|
+
# Acknowledgements and executivesummary use IsoClauseSection
|
|
21
22
|
attribute :acknowledgements, IsoClauseSection
|
|
22
|
-
|
|
23
|
-
# Executive summary section.
|
|
24
23
|
attribute :executivesummary, IsoClauseSection
|
|
25
24
|
|
|
26
|
-
attribute :semx_id, :string
|
|
27
|
-
attribute :displayorder, :integer
|
|
28
|
-
|
|
29
25
|
xml do
|
|
30
26
|
element "preface"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
ordered
|
|
28
|
+
|
|
29
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_preface_elements(self)
|
|
34
30
|
map_element "clause", to: :clause
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
map_attribute "semx-id", to: :semx_id
|
|
38
|
-
map_attribute "displayorder", to: :displayorder
|
|
31
|
+
|
|
32
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_preface_attributes(self)
|
|
39
33
|
end
|
|
40
34
|
end
|
|
41
35
|
end
|
|
@@ -4,56 +4,46 @@ module Metanorma
|
|
|
4
4
|
module IsoDocument
|
|
5
5
|
module Sections
|
|
6
6
|
# Main body of ISO/IEC document.
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
# Extends StandardDocument::Sections with ISO strict ordering:
|
|
8
|
+
# (note | admonition)*, clause, (term-clause | terms)?, definitions?,
|
|
9
|
+
# (clause | term-clause | terms)+
|
|
10
|
+
class IsoSections < Metanorma::StandardDocument::Sections::Sections
|
|
11
|
+
# Notes applicable to the entire document (appearing before clauses)
|
|
9
12
|
attribute :note,
|
|
10
13
|
Metanorma::Document::Components::Blocks::NoteBlock,
|
|
11
14
|
collection: true
|
|
12
15
|
|
|
13
|
-
# Admonitions applicable to the entire document
|
|
16
|
+
# Admonitions applicable to the entire document
|
|
14
17
|
attribute :admonition,
|
|
15
18
|
Metanorma::Document::Components::MultiParagraph::AdmonitionBlock,
|
|
16
19
|
collection: true
|
|
17
20
|
|
|
18
|
-
#
|
|
19
|
-
attribute :terms,
|
|
20
|
-
IsoTermsSection
|
|
21
|
+
# Override: ISO terms is singular (zero or one), uses IsoTermsSection
|
|
22
|
+
attribute :terms, IsoTermsSection
|
|
21
23
|
|
|
22
|
-
#
|
|
24
|
+
# Override: ISO definitions is singular (zero or one)
|
|
23
25
|
attribute :definitions,
|
|
24
26
|
Metanorma::StandardDocument::Sections::DefinitionSection
|
|
25
27
|
|
|
26
|
-
#
|
|
27
|
-
attribute :clause,
|
|
28
|
-
IsoClauseSection,
|
|
29
|
-
collection: true
|
|
30
|
-
|
|
31
|
-
# References section (can appear inside <sections> in presentation XML).
|
|
32
|
-
attribute :references,
|
|
33
|
-
Metanorma::StandardDocument::Sections::StandardReferencesSection,
|
|
34
|
-
collection: true
|
|
28
|
+
# Override: ISO clauses use IsoClauseSection
|
|
29
|
+
attribute :clause, IsoClauseSection, collection: true
|
|
35
30
|
|
|
36
|
-
# Initial paragraphs (document title repeated at start of sections
|
|
31
|
+
# Initial paragraphs (document title repeated at start of sections)
|
|
37
32
|
attribute :p,
|
|
38
33
|
Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
39
34
|
collection: true
|
|
40
35
|
|
|
41
|
-
# Presentation-specific attributes
|
|
42
|
-
attribute :semx_id, :string
|
|
43
|
-
attribute :displayorder, :integer
|
|
44
|
-
|
|
45
36
|
xml do
|
|
46
37
|
element "sections"
|
|
47
38
|
ordered
|
|
48
|
-
|
|
49
|
-
map_element "
|
|
50
|
-
map_element "
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
map_element "references", to: :references
|
|
39
|
+
|
|
40
|
+
map_element "note", to: :note
|
|
41
|
+
map_element "admonition", to: :admonition
|
|
42
|
+
|
|
43
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_sections_elements(self)
|
|
54
44
|
map_element "p", to: :p
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
|
|
46
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_sections_attributes(self)
|
|
57
47
|
end
|
|
58
48
|
end
|
|
59
49
|
end
|
|
@@ -12,6 +12,9 @@ module Metanorma
|
|
|
12
12
|
attribute :number, :string
|
|
13
13
|
attribute :obligation, :string
|
|
14
14
|
attribute :inline_header, :string
|
|
15
|
+
attribute :unnumbered, :string
|
|
16
|
+
attribute :toc, :string
|
|
17
|
+
attribute :class_attr, :string
|
|
15
18
|
attribute :title, Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
16
19
|
attribute :p, RawParagraph, collection: true
|
|
17
20
|
attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
|
|
@@ -58,12 +61,9 @@ module Metanorma
|
|
|
58
61
|
|
|
59
62
|
xml do
|
|
60
63
|
element "terms"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
map_attribute "number", to: :number
|
|
65
|
-
map_attribute "obligation", to: :obligation
|
|
66
|
-
map_attribute "inline-header", to: :inline_header
|
|
64
|
+
|
|
65
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
|
|
66
|
+
|
|
67
67
|
map_element "title", to: :title
|
|
68
68
|
map_element "fmt-title", to: :fmt_title
|
|
69
69
|
map_element "fmt-xref-label", to: :fmt_xref_label
|
|
@@ -78,9 +78,6 @@ module Metanorma
|
|
|
78
78
|
map_element "clause", to: :clause
|
|
79
79
|
map_element "fmt-annotation-start", to: :fmt_annotation_start
|
|
80
80
|
map_element "fmt-annotation-end", to: :fmt_annotation_end
|
|
81
|
-
map_attribute "semx-id", to: :semx_id
|
|
82
|
-
map_attribute "autonum", to: :autonum
|
|
83
|
-
map_attribute "displayorder", to: :displayorder
|
|
84
81
|
end
|
|
85
82
|
end
|
|
86
83
|
end
|
|
@@ -3,53 +3,8 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module IsoDocument
|
|
5
5
|
module Terms
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# Contains mixed content with inline elements like strike, em, etc.
|
|
9
|
-
class TermNameElement < Lutaml::Model::Serializable
|
|
10
|
-
attribute :id, :string
|
|
11
|
-
attribute :semx_id, :string
|
|
12
|
-
attribute :lang, :string
|
|
13
|
-
attribute :text, :string, collection: true
|
|
14
|
-
attribute :strike, Metanorma::Document::Components::TextElements::StrikeElement,
|
|
15
|
-
collection: true
|
|
16
|
-
attribute :em, Metanorma::Document::Components::Inline::EmRawElement,
|
|
17
|
-
collection: true
|
|
18
|
-
attribute :strong, Metanorma::Document::Components::Inline::StrongRawElement,
|
|
19
|
-
collection: true
|
|
20
|
-
attribute :sup, Metanorma::Document::Components::Inline::SupElement,
|
|
21
|
-
collection: true
|
|
22
|
-
attribute :sub, Metanorma::Document::Components::Inline::SubElement,
|
|
23
|
-
collection: true
|
|
24
|
-
|
|
25
|
-
xml do
|
|
26
|
-
element "name"
|
|
27
|
-
map_attribute "id", to: :id
|
|
28
|
-
map_attribute "semx-id", to: :semx_id
|
|
29
|
-
map_attribute "lang", to: :lang
|
|
30
|
-
mixed_content
|
|
31
|
-
map_content to: :text
|
|
32
|
-
map_element "strike", to: :strike
|
|
33
|
-
map_element "em", to: :em
|
|
34
|
-
map_element "strong", to: :strong
|
|
35
|
-
map_element "sup", to: :sup
|
|
36
|
-
map_element "sub", to: :sub
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Expression of a term designation.
|
|
41
|
-
class TermExpression < Lutaml::Model::Serializable
|
|
42
|
-
attribute :name, TermNameElement, collection: true
|
|
43
|
-
attribute :usage, :string
|
|
44
|
-
attribute :abbreviation_type, :string
|
|
45
|
-
|
|
46
|
-
xml do
|
|
47
|
-
element "expression"
|
|
48
|
-
map_element "name", to: :name
|
|
49
|
-
map_element "usage", to: :usage
|
|
50
|
-
map_element "abbreviation-type", to: :abbreviation_type
|
|
51
|
-
end
|
|
52
|
-
end
|
|
6
|
+
TermNameElement = Metanorma::StandardDocument::Terms::TermNameElement
|
|
7
|
+
TermExpression = Metanorma::StandardDocument::Terms::TermExpression
|
|
53
8
|
end
|
|
54
9
|
end
|
|
55
10
|
end
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module Terms
|
|
6
|
-
# Origin reference in a term source.
|
|
7
|
-
class TermOrigin < Lutaml::Model::Serializable
|
|
8
|
-
attribute :bibitemid, :string
|
|
9
|
-
attribute :type, :string
|
|
10
|
-
attribute :citeas, :string
|
|
11
|
-
attribute :locality_stack, Metanorma::Document::Relaton::LocalityStack,
|
|
12
|
-
collection: true
|
|
13
|
-
attribute :display_text, Metanorma::Document::Components::Inline::DisplayTextElement
|
|
14
|
-
|
|
15
|
-
xml do
|
|
16
|
-
element "origin"
|
|
17
|
-
map_attribute "bibitemid", to: :bibitemid
|
|
18
|
-
map_attribute "type", to: :type
|
|
19
|
-
map_attribute "citeas", to: :citeas
|
|
20
|
-
map_element "localityStack", to: :locality_stack
|
|
21
|
-
map_element "display-text", to: :display_text
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
3
|
+
Metanorma::IsoDocument::Terms::TermOrigin =
|
|
4
|
+
Metanorma::Document::Components::ReferenceElements::SourceOrigin
|
|
@@ -1,40 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
Metanorma::IsoDocument::Terms::TermSource =
|
|
4
|
+
Metanorma::Document::Components::ReferenceElements::SourceElement
|
|
5
|
+
|
|
3
6
|
module Metanorma
|
|
4
7
|
module IsoDocument
|
|
5
8
|
module Terms
|
|
6
|
-
|
|
7
|
-
class TermModification < Lutaml::Model::Serializable
|
|
8
|
-
attribute :id, :string
|
|
9
|
-
attribute :p, RawParagraph, collection: true
|
|
10
|
-
|
|
11
|
-
xml do
|
|
12
|
-
element "modification"
|
|
13
|
-
map_attribute "id", to: :id
|
|
14
|
-
map_element "p", to: :p
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Source of a term definition, with optional modification info.
|
|
19
|
-
class TermSource < Lutaml::Model::Serializable
|
|
20
|
-
attribute :id, :string
|
|
21
|
-
attribute :status, :string
|
|
22
|
-
attribute :type, :string
|
|
23
|
-
attribute :origin, TermOrigin
|
|
24
|
-
attribute :modification, TermModification
|
|
25
|
-
|
|
26
|
-
xml do
|
|
27
|
-
element "source"
|
|
28
|
-
map_attribute "id", to: :id
|
|
29
|
-
map_attribute "status", to: :status
|
|
30
|
-
map_attribute "type", to: :type
|
|
31
|
-
map_element "origin", to: :origin
|
|
32
|
-
map_element "modification", to: :modification
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Same structure as TermSource but mapped to the <termsource> element.
|
|
37
|
-
class TermsourceElement < TermSource
|
|
9
|
+
class TermsourceElement < Metanorma::Document::Components::ReferenceElements::SourceElement
|
|
38
10
|
xml do
|
|
39
11
|
element "termsource"
|
|
40
12
|
map_attribute "id", to: :id
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "metanorma/standard_document"
|
|
4
|
-
|
|
5
3
|
module Metanorma
|
|
6
4
|
module IsoDocument
|
|
7
5
|
autoload :AnnotationContainer, "metanorma/iso_document/annotation_container"
|
|
@@ -14,3 +12,5 @@ module Metanorma
|
|
|
14
12
|
autoload :Terms, "metanorma/iso_document/terms"
|
|
15
13
|
end
|
|
16
14
|
end
|
|
15
|
+
|
|
16
|
+
Metanorma::Registers::Setup.setup_iso_register
|