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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
module Sections
|
|
6
|
+
class Errata < Lutaml::Model::Serializable
|
|
7
|
+
attribute :rows, ErrataRow, collection: true
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
element "errata"
|
|
11
|
+
map_element "row", to: :rows
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
module Sections
|
|
6
|
+
class ErrataClause < Metanorma::StandardDocument::Sections::ContentSection
|
|
7
|
+
attribute :errata, Errata
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
element "errata_clause"
|
|
11
|
+
ordered
|
|
12
|
+
|
|
13
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
|
|
14
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_elements(self)
|
|
15
|
+
map_element "errata", to: :errata
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
module Sections
|
|
6
|
+
class ErrataRow < Lutaml::Model::Serializable
|
|
7
|
+
attribute :date, :string
|
|
8
|
+
attribute :type, :string
|
|
9
|
+
attribute :change, :string, collection: true
|
|
10
|
+
attribute :pages, :string
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
element "row"
|
|
14
|
+
map_element "date", to: :date
|
|
15
|
+
map_element "type", to: :type
|
|
16
|
+
map_element "change", to: :change
|
|
17
|
+
map_element "pages", to: :pages
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
module Sections
|
|
6
|
+
# NIST preface with errata and executivesummary support.
|
|
7
|
+
# Corresponds to nist.rnc:
|
|
8
|
+
# preface = element preface {
|
|
9
|
+
# abstract?, foreword?,
|
|
10
|
+
# (clause | errata_clause | acknowledgements)*,
|
|
11
|
+
# content*,
|
|
12
|
+
# executivesummary?
|
|
13
|
+
# }
|
|
14
|
+
class NistPreface < Metanorma::StandardDocument::Sections::Preface
|
|
15
|
+
attribute :errata_clause, ErrataClause, collection: true
|
|
16
|
+
|
|
17
|
+
xml do
|
|
18
|
+
element "preface"
|
|
19
|
+
ordered
|
|
20
|
+
|
|
21
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_preface_elements(self)
|
|
22
|
+
map_element "clause", to: :content
|
|
23
|
+
map_element "errata_clause", to: :errata_clause
|
|
24
|
+
|
|
25
|
+
Metanorma::StandardDocument::SectionXmlMapping.apply_preface_attributes(self)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
module Sections
|
|
6
|
+
autoload :Errata, "#{__dir__}/sections/errata"
|
|
7
|
+
autoload :ErrataClause, "#{__dir__}/sections/errata_clause"
|
|
8
|
+
autoload :ErrataRow, "#{__dir__}/sections/errata_row"
|
|
9
|
+
autoload :NistPreface, "#{__dir__}/sections/nist_preface"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module NistDocument
|
|
5
|
+
autoload :Metadata, "metanorma/nist_document/metadata"
|
|
6
|
+
autoload :Root, "metanorma/nist_document/root"
|
|
7
|
+
autoload :Sections, "metanorma/nist_document/sections"
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Metanorma::Registers::Setup.setup_nist_register
|
|
@@ -1,64 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "metanorma/standard_document"
|
|
4
|
-
require "metanorma/iso_document"
|
|
5
|
-
|
|
6
3
|
module Metanorma
|
|
7
4
|
module OgcDocument
|
|
8
|
-
class Root <
|
|
9
|
-
|
|
10
|
-
attribute :type, :string
|
|
11
|
-
attribute :schema_version, :string
|
|
12
|
-
attribute :flavor, :string
|
|
5
|
+
class Root < Lutaml::Model::Serializable
|
|
6
|
+
include Metanorma::StandardDocument::RootAttributes
|
|
13
7
|
|
|
14
8
|
attribute :bibdata, Metadata::OgcBibliographicItem
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
attribute :preface,
|
|
10
|
+
Metanorma::StandardDocument::Sections::Preface
|
|
11
|
+
attribute :sections,
|
|
12
|
+
Metanorma::StandardDocument::Sections::Sections
|
|
13
|
+
attribute :annex,
|
|
14
|
+
Metanorma::StandardDocument::Sections::AnnexSection,
|
|
18
15
|
collection: true
|
|
19
16
|
|
|
20
|
-
attribute :preface, Metanorma::IsoDocument::Sections::IsoPreface
|
|
21
|
-
attribute :sections, Metanorma::IsoDocument::Sections::IsoSections
|
|
22
|
-
attribute :annex, Metanorma::IsoDocument::Sections::IsoAnnexSection,
|
|
23
|
-
collection: true
|
|
24
|
-
attribute :bibliography,
|
|
25
|
-
Metanorma::StandardDocument::Sections::BibliographySection
|
|
26
|
-
attribute :boilerplate, Metanorma::IsoDocument::Boilerplate
|
|
27
|
-
attribute :metanorma_extension,
|
|
28
|
-
Metanorma::IsoDocument::Metadata::MetanormaExtension
|
|
29
|
-
attribute :annotation_container, Metanorma::IsoDocument::AnnotationContainer
|
|
30
|
-
attribute :indexsect,
|
|
31
|
-
Metanorma::Document::Components::Sections::BasicSection
|
|
32
|
-
attribute :autonum, :string
|
|
33
|
-
attribute :fmt_xref_label, :string
|
|
34
|
-
attribute :localized_strings,
|
|
35
|
-
Metanorma::Document::Components::Inline::LocalizedStringsElement
|
|
36
|
-
attribute :fmt_footnote_container,
|
|
37
|
-
Metanorma::Document::Components::Inline::FmtFootnoteContainerElement
|
|
38
|
-
attribute :colophon, Metanorma::IsoDocument::Sections::Colophon
|
|
39
|
-
|
|
40
17
|
xml do
|
|
41
18
|
element "metanorma"
|
|
42
19
|
namespace Metanorma::StandardDocument::Namespace
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
map_attribute "schema-version", to: :schema_version
|
|
46
|
-
map_attribute "flavor", to: :flavor
|
|
47
|
-
map_element "bibdata", to: :bibdata
|
|
48
|
-
map_element "termdocsource", to: :term_sources
|
|
49
|
-
map_element "metanorma-extension", to: :metanorma_extension
|
|
50
|
-
map_element "boilerplate", to: :boilerplate
|
|
51
|
-
map_element "preface", to: :preface
|
|
52
|
-
map_element "sections", to: :sections
|
|
53
|
-
map_element "annex", to: :annex
|
|
54
|
-
map_element "bibliography", to: :bibliography
|
|
55
|
-
map_element "annotation-container", to: :annotation_container
|
|
56
|
-
map_element "indexsect", to: :indexsect
|
|
57
|
-
map_element "localized-strings", to: :localized_strings
|
|
58
|
-
map_element "fmt-footnote-container", to: :fmt_footnote_container
|
|
59
|
-
map_element "colophon", to: :colophon
|
|
60
|
-
map_attribute "autonum", to: :autonum
|
|
61
|
-
map_attribute "fmt-xref-label", to: :fmt_xref_label
|
|
20
|
+
|
|
21
|
+
Metanorma::StandardDocument::RootXmlMapping.apply(self)
|
|
62
22
|
end
|
|
63
23
|
end
|
|
64
24
|
end
|
|
@@ -1,65 +1,26 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "metanorma/standard_document"
|
|
4
|
-
require "metanorma/iso_document"
|
|
5
|
-
|
|
6
3
|
module Metanorma
|
|
7
4
|
module OimlDocument
|
|
8
|
-
class Root <
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
class Root < Lutaml::Model::Serializable
|
|
6
|
+
include Metanorma::StandardDocument::RootAttributes
|
|
7
|
+
|
|
8
|
+
def self.lutaml_default_register
|
|
9
|
+
:oiml_document
|
|
10
|
+
end
|
|
13
11
|
|
|
14
12
|
attribute :bibdata,
|
|
15
13
|
Metanorma::IsoDocument::Metadata::IsoBibliographicItem
|
|
16
|
-
|
|
17
|
-
attribute :term_sources,
|
|
18
|
-
Metanorma::Document::Components::ReferenceElements::Citation,
|
|
19
|
-
collection: true
|
|
20
|
-
|
|
21
14
|
attribute :preface, Metanorma::IsoDocument::Sections::IsoPreface
|
|
22
15
|
attribute :sections, Metanorma::IsoDocument::Sections::IsoSections
|
|
23
16
|
attribute :annex, Metanorma::IsoDocument::Sections::IsoAnnexSection,
|
|
24
17
|
collection: true
|
|
25
|
-
attribute :bibliography,
|
|
26
|
-
Metanorma::StandardDocument::Sections::BibliographySection
|
|
27
|
-
attribute :boilerplate, Metanorma::IsoDocument::Boilerplate
|
|
28
|
-
attribute :metanorma_extension,
|
|
29
|
-
Metanorma::IsoDocument::Metadata::MetanormaExtension
|
|
30
|
-
attribute :annotation_container, Metanorma::IsoDocument::AnnotationContainer
|
|
31
|
-
attribute :indexsect,
|
|
32
|
-
Metanorma::Document::Components::Sections::BasicSection
|
|
33
|
-
attribute :autonum, :string
|
|
34
|
-
attribute :fmt_xref_label, :string
|
|
35
|
-
attribute :localized_strings,
|
|
36
|
-
Metanorma::Document::Components::Inline::LocalizedStringsElement
|
|
37
|
-
attribute :fmt_footnote_container,
|
|
38
|
-
Metanorma::Document::Components::Inline::FmtFootnoteContainerElement
|
|
39
|
-
attribute :colophon, Metanorma::IsoDocument::Sections::Colophon
|
|
40
18
|
|
|
41
19
|
xml do
|
|
42
20
|
element "metanorma"
|
|
43
21
|
namespace Metanorma::StandardDocument::Namespace
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
map_attribute "schema-version", to: :schema_version
|
|
47
|
-
map_attribute "flavor", to: :flavor
|
|
48
|
-
map_element "bibdata", to: :bibdata
|
|
49
|
-
map_element "termdocsource", to: :term_sources
|
|
50
|
-
map_element "metanorma-extension", to: :metanorma_extension
|
|
51
|
-
map_element "boilerplate", to: :boilerplate
|
|
52
|
-
map_element "preface", to: :preface
|
|
53
|
-
map_element "sections", to: :sections
|
|
54
|
-
map_element "annex", to: :annex
|
|
55
|
-
map_element "bibliography", to: :bibliography
|
|
56
|
-
map_element "annotation-container", to: :annotation_container
|
|
57
|
-
map_element "indexsect", to: :indexsect
|
|
58
|
-
map_element "localized-strings", to: :localized_strings
|
|
59
|
-
map_element "fmt-footnote-container", to: :fmt_footnote_container
|
|
60
|
-
map_element "colophon", to: :colophon
|
|
61
|
-
map_attribute "autonum", to: :autonum
|
|
62
|
-
map_attribute "fmt-xref-label", to: :fmt_xref_label
|
|
22
|
+
|
|
23
|
+
Metanorma::StandardDocument::RootXmlMapping.apply(self)
|
|
63
24
|
end
|
|
64
25
|
end
|
|
65
26
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "metanorma/standard_document"
|
|
4
|
-
require "metanorma/iso_document"
|
|
5
|
-
|
|
6
3
|
module Metanorma
|
|
7
4
|
module OimlDocument
|
|
8
5
|
autoload :Root, "metanorma/oiml_document/root"
|
|
9
6
|
end
|
|
10
7
|
end
|
|
8
|
+
|
|
9
|
+
Metanorma::Registers::Setup.setup_oiml_register
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module PlateauDocument
|
|
5
|
+
class Root < Lutaml::Model::Serializable
|
|
6
|
+
include Metanorma::StandardDocument::RootAttributes
|
|
7
|
+
|
|
8
|
+
def self.lutaml_default_register
|
|
9
|
+
:plateau_document
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
attribute :bibdata, Metadata::PlateauBibliographicItem
|
|
13
|
+
attribute :preface,
|
|
14
|
+
Metanorma::IsoDocument::Sections::IsoPreface
|
|
15
|
+
attribute :sections,
|
|
16
|
+
Metanorma::IsoDocument::Sections::IsoSections
|
|
17
|
+
attribute :annex,
|
|
18
|
+
Metanorma::JisDocument::Sections::JisAnnexSection,
|
|
19
|
+
collection: true
|
|
20
|
+
|
|
21
|
+
xml do
|
|
22
|
+
element "metanorma"
|
|
23
|
+
namespace Metanorma::StandardDocument::Namespace
|
|
24
|
+
|
|
25
|
+
Metanorma::StandardDocument::RootXmlMapping.apply(self)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module Registers
|
|
5
|
+
module Setup
|
|
6
|
+
class << self
|
|
7
|
+
# ============================================================
|
|
8
|
+
# ISO-family registers — fallback to :iso_document
|
|
9
|
+
# ============================================================
|
|
10
|
+
|
|
11
|
+
def setup_iso_register
|
|
12
|
+
sd = Metanorma::StandardDocument
|
|
13
|
+
iso = Metanorma::IsoDocument
|
|
14
|
+
reg = Lutaml::Model::Register.new(:iso_document)
|
|
15
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
16
|
+
|
|
17
|
+
reg.register_global_type_substitution(
|
|
18
|
+
from_type: sd::Sections::ClauseSection,
|
|
19
|
+
to_type: iso::Sections::IsoClauseSection,
|
|
20
|
+
)
|
|
21
|
+
reg.register_global_type_substitution(
|
|
22
|
+
from_type: sd::Sections::AnnexSection,
|
|
23
|
+
to_type: iso::Sections::IsoAnnexSection,
|
|
24
|
+
)
|
|
25
|
+
reg.register_global_type_substitution(
|
|
26
|
+
from_type: sd::Sections::Sections,
|
|
27
|
+
to_type: iso::Sections::IsoSections,
|
|
28
|
+
)
|
|
29
|
+
reg.register_global_type_substitution(
|
|
30
|
+
from_type: sd::Sections::Preface,
|
|
31
|
+
to_type: iso::Sections::IsoPreface,
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def setup_iec_register
|
|
36
|
+
reg = Lutaml::Model::Register.new(:iec_document,
|
|
37
|
+
fallback: [:iso_document])
|
|
38
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def setup_oiml_register
|
|
42
|
+
reg = Lutaml::Model::Register.new(:oiml_document,
|
|
43
|
+
fallback: [:iso_document])
|
|
44
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def setup_bsi_register
|
|
48
|
+
iso = Metanorma::IsoDocument
|
|
49
|
+
reg = Lutaml::Model::Register.new(:bsi_document,
|
|
50
|
+
fallback: [:iso_document])
|
|
51
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
52
|
+
|
|
53
|
+
reg.register_global_type_substitution(
|
|
54
|
+
from_type: iso::Sections::IsoSections,
|
|
55
|
+
to_type: Metanorma::BsiDocument::Sections::BsiSections,
|
|
56
|
+
)
|
|
57
|
+
reg.register_global_type_substitution(
|
|
58
|
+
from_type: iso::Sections::IsoClauseSection,
|
|
59
|
+
to_type: Metanorma::BsiDocument::Sections::BsiClauseSection,
|
|
60
|
+
)
|
|
61
|
+
reg.register_global_type_substitution(
|
|
62
|
+
from_type: iso::Sections::IsoAnnexSection,
|
|
63
|
+
to_type: Metanorma::BsiDocument::Sections::BsiAnnexSection,
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def setup_jis_register
|
|
68
|
+
iso = Metanorma::IsoDocument
|
|
69
|
+
reg = Lutaml::Model::Register.new(:jis_document,
|
|
70
|
+
fallback: [:iso_document])
|
|
71
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
72
|
+
|
|
73
|
+
reg.register_global_type_substitution(
|
|
74
|
+
from_type: iso::Sections::IsoAnnexSection,
|
|
75
|
+
to_type: Metanorma::JisDocument::Sections::JisAnnexSection,
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def setup_gb_register
|
|
80
|
+
reg = Lutaml::Model::Register.new(:gb_document,
|
|
81
|
+
fallback: [:iso_document])
|
|
82
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def setup_m3d_register
|
|
86
|
+
reg = Lutaml::Model::Register.new(:m3d_document)
|
|
87
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def setup_plateau_register
|
|
91
|
+
reg = Lutaml::Model::Register.new(:plateau_document,
|
|
92
|
+
fallback: [:jis_document])
|
|
93
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# ============================================================
|
|
97
|
+
# Isodoc-family registers — no ISO fallback
|
|
98
|
+
# ============================================================
|
|
99
|
+
|
|
100
|
+
def setup_ieee_register
|
|
101
|
+
sd = Metanorma::StandardDocument
|
|
102
|
+
reg = Lutaml::Model::Register.new(:ieee_document)
|
|
103
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
104
|
+
|
|
105
|
+
reg.register_global_type_substitution(
|
|
106
|
+
from_type: sd::Sections::Sections,
|
|
107
|
+
to_type: Metanorma::IeeeDocument::Sections::IeeeSections,
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def setup_ietf_register
|
|
112
|
+
sd = Metanorma::StandardDocument
|
|
113
|
+
reg = Lutaml::Model::Register.new(:ietf_document)
|
|
114
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
115
|
+
|
|
116
|
+
reg.register_global_type_substitution(
|
|
117
|
+
from_type: sd::Sections::Sections,
|
|
118
|
+
to_type: Metanorma::IetfDocument::Sections::IetfSections,
|
|
119
|
+
)
|
|
120
|
+
reg.register_global_type_substitution(
|
|
121
|
+
from_type: sd::Sections::ContentSection,
|
|
122
|
+
to_type: Metanorma::IetfDocument::Sections::IetfContentSection,
|
|
123
|
+
)
|
|
124
|
+
reg.register_global_type_substitution(
|
|
125
|
+
from_type: sd::Sections::ClauseSection,
|
|
126
|
+
to_type: Metanorma::IetfDocument::Sections::IetfClauseSection,
|
|
127
|
+
)
|
|
128
|
+
reg.register_global_type_substitution(
|
|
129
|
+
from_type: sd::Sections::AnnexSection,
|
|
130
|
+
to_type: Metanorma::IetfDocument::Sections::IetfAnnexSection,
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def setup_nist_register
|
|
135
|
+
sd = Metanorma::StandardDocument
|
|
136
|
+
reg = Lutaml::Model::Register.new(:nist_document)
|
|
137
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
138
|
+
|
|
139
|
+
reg.register_global_type_substitution(
|
|
140
|
+
from_type: sd::Sections::Preface,
|
|
141
|
+
to_type: Metanorma::NistDocument::Sections::NistPreface,
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def setup_un_register
|
|
146
|
+
sd = Metanorma::StandardDocument
|
|
147
|
+
reg = Lutaml::Model::Register.new(:un_document)
|
|
148
|
+
Lutaml::Model::GlobalRegister.register(reg)
|
|
149
|
+
|
|
150
|
+
reg.register_global_type_substitution(
|
|
151
|
+
from_type: sd::Sections::Sections,
|
|
152
|
+
to_type: Metanorma::UnDocument::Sections::UnSections,
|
|
153
|
+
)
|
|
154
|
+
reg.register_global_type_substitution(
|
|
155
|
+
from_type: sd::Sections::Preface,
|
|
156
|
+
to_type: Metanorma::UnDocument::Sections::UnPreface,
|
|
157
|
+
)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
@@ -1,67 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "metanorma/standard_document"
|
|
4
|
-
require "metanorma/iso_document"
|
|
5
|
-
|
|
6
3
|
module Metanorma
|
|
7
4
|
module RiboseDocument
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Root < Metanorma::StandardDocument::Root
|
|
11
|
-
attribute :version, :string
|
|
12
|
-
attribute :type, :string
|
|
13
|
-
attribute :schema_version, :string
|
|
14
|
-
attribute :flavor, :string
|
|
5
|
+
class Root < Lutaml::Model::Serializable
|
|
6
|
+
include Metanorma::StandardDocument::RootAttributes
|
|
15
7
|
|
|
16
8
|
attribute :bibdata,
|
|
17
9
|
Metanorma::RiboseDocument::Metadata::RiboseBibliographicItem
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
attribute :preface,
|
|
11
|
+
Metanorma::StandardDocument::Sections::Preface
|
|
12
|
+
attribute :sections,
|
|
13
|
+
Metanorma::StandardDocument::Sections::Sections
|
|
14
|
+
attribute :annex,
|
|
15
|
+
Metanorma::StandardDocument::Sections::AnnexSection,
|
|
21
16
|
collection: true
|
|
22
17
|
|
|
23
|
-
attribute :preface, Metanorma::IsoDocument::Sections::IsoPreface
|
|
24
|
-
attribute :sections, Metanorma::IsoDocument::Sections::IsoSections
|
|
25
|
-
attribute :annex, Metanorma::IsoDocument::Sections::IsoAnnexSection,
|
|
26
|
-
collection: true
|
|
27
|
-
attribute :bibliography,
|
|
28
|
-
Metanorma::StandardDocument::Sections::BibliographySection
|
|
29
|
-
attribute :boilerplate, Metanorma::IsoDocument::Boilerplate
|
|
30
|
-
attribute :metanorma_extension,
|
|
31
|
-
Metanorma::IsoDocument::Metadata::MetanormaExtension
|
|
32
|
-
attribute :annotation_container, Metanorma::IsoDocument::AnnotationContainer
|
|
33
|
-
attribute :indexsect,
|
|
34
|
-
Metanorma::Document::Components::Sections::BasicSection
|
|
35
|
-
attribute :autonum, :string
|
|
36
|
-
attribute :fmt_xref_label, :string
|
|
37
|
-
attribute :localized_strings,
|
|
38
|
-
Metanorma::Document::Components::Inline::LocalizedStringsElement
|
|
39
|
-
attribute :fmt_footnote_container,
|
|
40
|
-
Metanorma::Document::Components::Inline::FmtFootnoteContainerElement
|
|
41
|
-
attribute :colophon, Metanorma::IsoDocument::Sections::Colophon
|
|
42
|
-
|
|
43
18
|
xml do
|
|
44
19
|
element "metanorma"
|
|
45
20
|
namespace Metanorma::StandardDocument::Namespace
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
map_attribute "schema-version", to: :schema_version
|
|
49
|
-
map_attribute "flavor", to: :flavor
|
|
50
|
-
map_element "bibdata", to: :bibdata
|
|
51
|
-
map_element "termdocsource", to: :term_sources
|
|
52
|
-
map_element "metanorma-extension", to: :metanorma_extension
|
|
53
|
-
map_element "boilerplate", to: :boilerplate
|
|
54
|
-
map_element "preface", to: :preface
|
|
55
|
-
map_element "sections", to: :sections
|
|
56
|
-
map_element "annex", to: :annex
|
|
57
|
-
map_element "bibliography", to: :bibliography
|
|
58
|
-
map_element "annotation-container", to: :annotation_container
|
|
59
|
-
map_element "indexsect", to: :indexsect
|
|
60
|
-
map_element "localized-strings", to: :localized_strings
|
|
61
|
-
map_element "fmt-footnote-container", to: :fmt_footnote_container
|
|
62
|
-
map_element "colophon", to: :colophon
|
|
63
|
-
map_attribute "autonum", to: :autonum
|
|
64
|
-
map_attribute "fmt-xref-label", to: :fmt_xref_label
|
|
21
|
+
|
|
22
|
+
Metanorma::StandardDocument::RootXmlMapping.apply(self)
|
|
65
23
|
end
|
|
66
24
|
end
|
|
67
25
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Metanorma
|
|
4
|
+
module StandardDocument
|
|
5
|
+
class AnnotationContainer < Lutaml::Model::Serializable
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
element "annotation-container"
|
|
10
|
+
map_all_content to: :content
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|