metanorma-document 0.2.6 → 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 +198 -111
- 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/figure_drop.rb +14 -5
- data/lib/metanorma/html/drops/formula_drop.rb +7 -2
- 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
|
@@ -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
|
|
@@ -3,71 +3,74 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
|
-
# Definition sections consist of one or more definition lists
|
|
7
|
-
#
|
|
8
|
-
#
|
|
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
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
class DefinitionSection <
|
|
17
|
-
attribute :
|
|
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
|
+
attribute :id, :string
|
|
18
|
+
attribute :anchor, :string
|
|
18
19
|
attribute :type, :string
|
|
20
|
+
attribute :number, :string
|
|
19
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
|
|
20
28
|
|
|
21
29
|
# Block content
|
|
22
|
-
attribute :id, :string
|
|
23
|
-
attribute :anchor, :string
|
|
24
|
-
attribute :title, Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
25
30
|
attribute :paragraphs,
|
|
26
31
|
Metanorma::Document::Components::Paragraphs::ParagraphBlock,
|
|
27
32
|
collection: true
|
|
28
|
-
attribute :definition_lists,
|
|
29
|
-
Metanorma::Document::Components::Lists::DefinitionList,
|
|
30
|
-
collection: true
|
|
31
33
|
attribute :unordered_lists,
|
|
32
34
|
Metanorma::Document::Components::Lists::UnorderedList,
|
|
33
35
|
collection: true
|
|
34
|
-
attribute :
|
|
35
|
-
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
36
|
-
collection: true
|
|
37
|
-
attribute :table,
|
|
36
|
+
attribute :tables,
|
|
38
37
|
Metanorma::Document::Components::Tables::TableBlock,
|
|
39
38
|
collection: true
|
|
39
|
+
attribute :definition_lists,
|
|
40
|
+
Metanorma::Document::Components::Lists::DefinitionList,
|
|
41
|
+
collection: true
|
|
42
|
+
attribute :examples,
|
|
43
|
+
Metanorma::Document::Components::AncillaryBlocks::ExampleBlock,
|
|
44
|
+
collection: true
|
|
40
45
|
|
|
46
|
+
# Recursive definitions
|
|
47
|
+
attribute :definitions, DefinitionSection, collection: true
|
|
48
|
+
|
|
49
|
+
# Presentation-specific attributes
|
|
41
50
|
attribute :semx_id, :string
|
|
42
|
-
attribute :original_id, :string
|
|
43
51
|
attribute :autonum, :string
|
|
44
52
|
attribute :displayorder, :integer
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
attribute :
|
|
48
|
-
|
|
53
|
+
attribute :fmt_title,
|
|
54
|
+
Metanorma::Document::Components::Inline::FmtTitleElement
|
|
55
|
+
attribute :fmt_xref_label,
|
|
56
|
+
Metanorma::Document::Components::Inline::FmtXrefLabelElement,
|
|
49
57
|
collection: true
|
|
50
58
|
|
|
51
59
|
xml do
|
|
52
60
|
element "definitions"
|
|
53
61
|
ordered
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
map_element "
|
|
59
|
-
map_element "
|
|
60
|
-
map_element "
|
|
61
|
-
map_element "
|
|
62
|
-
map_element "example",
|
|
63
|
-
map_element "
|
|
64
|
-
map_element "
|
|
65
|
-
map_element "fmt-title", to: :fmt_title
|
|
62
|
+
|
|
63
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
|
|
64
|
+
|
|
65
|
+
map_element "title", to: :title
|
|
66
|
+
map_element "p", to: :paragraphs
|
|
67
|
+
map_element "ul", to: :unordered_lists
|
|
68
|
+
map_element "table", to: :tables
|
|
69
|
+
map_element "dl", to: :definition_lists
|
|
70
|
+
map_element "example", to: :examples
|
|
71
|
+
map_element "definitions", to: :definitions
|
|
72
|
+
map_element "fmt-title", to: :fmt_title
|
|
66
73
|
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
|
|
71
74
|
end
|
|
72
75
|
end
|
|
73
76
|
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::
|
|
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::
|
|
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 :
|
|
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
|
-
|
|
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,56 @@
|
|
|
3
3
|
module Metanorma
|
|
4
4
|
module StandardDocument
|
|
5
5
|
module Sections
|
|
6
|
-
#
|
|
7
|
-
|
|
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
|
+
|
|
15
|
+
# Section identity
|
|
16
|
+
attribute :id, :string
|
|
8
17
|
attribute :type, :string
|
|
18
|
+
attribute :number, :string
|
|
19
|
+
attribute :obligation, :string
|
|
20
|
+
attribute :inline_header, :string
|
|
21
|
+
attribute :unnumbered, :string
|
|
22
|
+
attribute :toc, :string
|
|
23
|
+
attribute :class_attr, :string
|
|
24
|
+
attribute :title,
|
|
25
|
+
Metanorma::Document::Components::Inline::TitleWithAnnotationElement
|
|
26
|
+
|
|
27
|
+
# Nested content subsections (recursive)
|
|
28
|
+
attribute :subsection, ContentSection, collection: true
|
|
9
29
|
|
|
30
|
+
# Presentation-specific attributes
|
|
31
|
+
attribute :anchor, :string
|
|
10
32
|
attribute :semx_id, :string
|
|
11
|
-
attribute :original_id, :string
|
|
12
33
|
attribute :autonum, :string
|
|
13
34
|
attribute :displayorder, :integer
|
|
35
|
+
attribute :fmt_title,
|
|
36
|
+
Metanorma::Document::Components::Inline::FmtTitleElement
|
|
37
|
+
attribute :fmt_xref_label,
|
|
38
|
+
Metanorma::Document::Components::Inline::FmtXrefLabelElement,
|
|
39
|
+
collection: true
|
|
40
|
+
attribute :variant_title,
|
|
41
|
+
Metanorma::Document::Components::Inline::VariantTitleElement,
|
|
42
|
+
collection: true
|
|
43
|
+
attribute :fmt_annotation_start,
|
|
44
|
+
Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
|
|
45
|
+
collection: true
|
|
46
|
+
attribute :fmt_annotation_end,
|
|
47
|
+
Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
|
|
48
|
+
collection: true
|
|
14
49
|
|
|
15
50
|
xml do
|
|
16
|
-
element "
|
|
17
|
-
|
|
51
|
+
element "clause"
|
|
52
|
+
ordered
|
|
18
53
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
map_attribute "autonum", to: :autonum
|
|
22
|
-
map_attribute "displayorder", to: :displayorder
|
|
54
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
|
|
55
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_elements(self)
|
|
23
56
|
end
|
|
24
57
|
end
|
|
25
58
|
end
|