metanorma-document 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +9 -412
  3. data/lib/metanorma/document/components/blocks/note_block.rb +1 -1
  4. data/lib/metanorma/document/components/inline/eref_element.rb +1 -1
  5. data/lib/metanorma/document/components/inline/fn_element.rb +1 -1
  6. data/lib/metanorma/document/components/lists/unordered_list.rb +2 -2
  7. data/lib/metanorma/document/components/multi_paragraph/admonition_block.rb +5 -2
  8. data/lib/metanorma/document/components/paragraphs/paragraph_block.rb +2 -2
  9. data/lib/metanorma/document/version.rb +1 -1
  10. data/lib/metanorma/html/base_renderer.rb +10 -11
  11. data/lib/metanorma/html/generator.rb +15 -22
  12. data/lib/metanorma/html/iso_renderer.rb +24 -1
  13. data/lib/metanorma/ietf_document/sections/ietf_annex_section.rb +1 -1
  14. data/lib/metanorma/ietf_document/sections/ietf_clause_section.rb +1 -1
  15. data/lib/metanorma/ietf_document/sections/ietf_content_section.rb +1 -1
  16. data/lib/metanorma/iso_document/metadata/doc_identifier.rb +1 -1
  17. data/lib/metanorma/iso_document/sections/iso_foreword_section.rb +2 -13
  18. data/lib/metanorma/iso_document/sections/iso_terms_section.rb +7 -16
  19. data/lib/metanorma/iso_document/terms/term_example.rb +2 -1
  20. data/lib/metanorma/iso_document/terms/term_note.rb +2 -1
  21. data/lib/metanorma/iso_document/terms/verbal_definition.rb +2 -1
  22. data/lib/metanorma/iso_document.rb +0 -1
  23. data/lib/metanorma/jis_document/sections/jis_annex_section.rb +1 -1
  24. data/lib/metanorma/standard_document/annotation_container.rb +25 -2
  25. data/lib/metanorma/standard_document/block_attributes.rb +42 -0
  26. data/lib/metanorma/standard_document/blocks/amend_content_block.rb +21 -3
  27. data/lib/metanorma/standard_document/blocks/standard_block_no_notes.rb +2 -2
  28. data/lib/metanorma/standard_document/boilerplate.rb +20 -2
  29. data/lib/metanorma/standard_document/sections/annex_section.rb +8 -36
  30. data/lib/metanorma/standard_document/sections/clause_hierarchical_section.rb +1 -1
  31. data/lib/metanorma/standard_document/sections/clause_section.rb +4 -34
  32. data/lib/metanorma/standard_document/sections/definition_section.rb +15 -21
  33. data/lib/metanorma/standard_document/sections/standard_content_section.rb +3 -22
  34. data/lib/metanorma/standard_document/sections/standard_hierarchical_section.rb +1 -1
  35. data/lib/metanorma/standard_document/sections/standard_references_section.rb +2 -2
  36. data/lib/metanorma/standard_document/sections/standard_section.rb +1 -1
  37. data/lib/metanorma/standard_document/sections/terms_section.rb +6 -16
  38. data/lib/metanorma/standard_document.rb +3 -0
  39. metadata +2 -3
  40. data/lib/metanorma/iso_document/raw_paragraph.rb +0 -23
@@ -56,29 +56,22 @@ module Metanorma
56
56
  contributors = bibdata.contributor
57
57
  return false unless contributors
58
58
 
59
- begin
60
- contributors.any? do |c|
61
- begin
62
- next false unless c.role&.any? do |r|
63
- r&.type == "author"
64
- end
65
- rescue StandardError
66
- false
67
- end
68
- org = c.organization
69
- next false unless org
70
-
71
- org_abbrev = org.abbreviation
72
- if org_abbrev.is_a?(String)
73
- org_abbrev == abbrev
74
- elsif org_abbrev.is_a?(Lutaml::Model::Serializable)
75
- safe_attr(org_abbrev, :content) == abbrev
76
- else
77
- org_abbrev.to_s == abbrev
78
- end
59
+ contributors.any? do |c|
60
+ roles = c.role
61
+ next false unless roles.is_a?(Array)
62
+ next false unless roles.any? { |r| r&.type == "author" }
63
+
64
+ org = c.organization
65
+ next false unless org
66
+
67
+ org_abbrev = org.abbreviation
68
+ if org_abbrev.is_a?(String)
69
+ org_abbrev == abbrev
70
+ elsif org_abbrev.is_a?(Lutaml::Model::Serializable)
71
+ safe_attr(org_abbrev, :content) == abbrev
72
+ else
73
+ org_abbrev.to_s == abbrev
79
74
  end
80
- rescue StandardError
81
- false
82
75
  end
83
76
  end
84
77
 
@@ -589,7 +589,7 @@ module Metanorma
589
589
  def render_boilerplate(boilerplate, **_opts)
590
590
  return unless boilerplate
591
591
 
592
- content = boilerplate.content
592
+ content = boilerplate_to_xml(boilerplate)
593
593
  return unless content
594
594
 
595
595
  @output << "<div class=\"boilerplate-copyright\">"
@@ -616,6 +616,29 @@ module Metanorma
616
616
  @output << "</div>"
617
617
  end
618
618
 
619
+ def boilerplate_to_xml(boilerplate)
620
+ parts = []
621
+ %i[copyright_statement license_statement legal_statement
622
+ feedback_statement clause].each do |attr|
623
+ items = boilerplate.public_send(attr)
624
+ next unless items
625
+
626
+ tag = attr.to_s.gsub("_", "-")
627
+ items.each do |item|
628
+ inner = item.to_xml
629
+ next if !inner || inner.strip.empty?
630
+
631
+ # Strip the outer <clause> wrapper — the inner content is what matters
632
+ stripped = inner.strip
633
+ stripped = stripped.sub(%r{^<clause[^>]*>\n?}, "").sub(%r{\n?</clause>$}, "")
634
+ parts << "<#{tag}>#{stripped}</#{tag}>"
635
+ end
636
+ end
637
+ return nil if parts.empty?
638
+
639
+ parts.join("\n")
640
+ end
641
+
619
642
  def convert_boilerplate_links(raw)
620
643
  doc = Nokogiri::XML.fragment(raw)
621
644
  doc.css("link").each do |link|
@@ -6,7 +6,7 @@ module Metanorma
6
6
  class IetfAnnexSection < Metanorma::StandardDocument::Sections::AnnexSection
7
7
  # IETF-specific attributes
8
8
  attribute :numbered, :string
9
- attribute :remove_in_rfc, :string
9
+ attribute :remove_in_rfc, :boolean
10
10
 
11
11
  # Sub-clauses within IETF annex use IetfClauseSection
12
12
  attribute :clause, IetfClauseSection, collection: true
@@ -6,7 +6,7 @@ module Metanorma
6
6
  class IetfClauseSection < Metanorma::StandardDocument::Sections::ClauseSection
7
7
  # IETF-specific attributes
8
8
  attribute :numbered, :string
9
- attribute :remove_in_rfc, :string
9
+ attribute :remove_in_rfc, :boolean
10
10
 
11
11
  # Recursive IETF sub-clauses
12
12
  attribute :clause, IetfClauseSection, collection: true
@@ -5,7 +5,7 @@ module Metanorma
5
5
  module Sections
6
6
  class IetfContentSection < Metanorma::StandardDocument::Sections::ContentSection
7
7
  attribute :numbered, :string
8
- attribute :remove_in_rfc, :string
8
+ attribute :remove_in_rfc, :boolean
9
9
 
10
10
  # Recursive IETF sub-clauses
11
11
  attribute :subsection, IetfContentSection, collection: true
@@ -7,7 +7,7 @@ module Metanorma
7
7
  # Used for the multiple <docidentifier> elements in bibdata/bibitem.
8
8
  class DocIdentifier < Lutaml::Model::Serializable
9
9
  attribute :type, :string
10
- attribute :primary, :string
10
+ attribute :primary, :boolean
11
11
  attribute :scope, :string
12
12
  attribute :language, :string
13
13
  attribute :value, :string
@@ -11,19 +11,8 @@ module Metanorma
11
11
  element "foreword"
12
12
  ordered
13
13
 
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
19
-
20
- map_element "title", to: :title
21
- map_element "fmt-title", to: :fmt_title
22
-
23
- Metanorma::StandardDocument::BlockXmlMapping.apply_block_mappings(self)
24
-
25
- map_element "fmt-annotation-start", to: :fmt_annotation_start
26
- map_element "fmt-annotation-end", to: :fmt_annotation_end
14
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
15
+ Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_elements(self)
27
16
  end
28
17
 
29
18
  json do
@@ -6,17 +6,19 @@ module Metanorma
6
6
  # Terms section specific to ISO/IEC documents.
7
7
  # Maps <terms> element with <title>, <p>, <ul>, <term> children.
8
8
  class IsoTermsSection < Lutaml::Model::Serializable
9
+ include Metanorma::StandardDocument::PresentationAttributes
10
+
9
11
  attribute :id, :string
10
- attribute :anchor, :string
11
12
  attribute :type, :string
12
13
  attribute :number, :string
13
14
  attribute :obligation, :string
14
- attribute :inline_header, :string
15
- attribute :unnumbered, :string
15
+ attribute :inline_header, :boolean
16
+ attribute :unnumbered, :boolean
16
17
  attribute :toc, :string
17
18
  attribute :class_attr, :string
18
19
  attribute :title, Metanorma::Document::Components::Inline::TitleWithAnnotationElement
19
- attribute :p, RawParagraph, collection: true
20
+ attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
21
+ collection: true
20
22
  attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
21
23
  collection: true
22
24
  attribute :term, Metanorma::IsoDocument::Terms::IsoTerm,
@@ -46,18 +48,6 @@ module Metanorma
46
48
 
47
49
  # Nested clause sections inside terms
48
50
  attribute :clause, IsoClauseSection, collection: true
49
- attribute :semx_id, :string
50
- attribute :autonum, :string
51
- attribute :displayorder, :integer
52
- attribute :fmt_title, Metanorma::Document::Components::Inline::FmtTitleElement
53
- attribute :fmt_xref_label,
54
- Metanorma::Document::Components::Inline::FmtXrefLabelElement, collection: true
55
- attribute :fmt_annotation_start,
56
- Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
57
- collection: true
58
- attribute :fmt_annotation_end,
59
- Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
60
- collection: true
61
51
 
62
52
  xml do
63
53
  element "terms"
@@ -65,6 +55,7 @@ module Metanorma
65
55
  Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
66
56
 
67
57
  map_element "title", to: :title
58
+ map_element "variant-title", to: :variant_title
68
59
  map_element "fmt-title", to: :fmt_title
69
60
  map_element "fmt-xref-label", to: :fmt_xref_label
70
61
  map_element "p", to: :p
@@ -8,7 +8,8 @@ module Metanorma
8
8
  attribute :id, :string
9
9
  attribute :semx_id, :string
10
10
  attribute :autonum, :string
11
- attribute :p, RawParagraph, collection: true
11
+ attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
12
+ collection: true
12
13
  attribute :ol, Metanorma::Document::Components::Lists::OrderedList,
13
14
  collection: true
14
15
  attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
@@ -9,7 +9,8 @@ module Metanorma
9
9
  attribute :anchor, :string
10
10
  attribute :semx_id, :string
11
11
  attribute :autonum, :string
12
- attribute :p, RawParagraph, collection: true
12
+ attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
13
+ collection: true
13
14
  attribute :ol, Metanorma::Document::Components::Lists::OrderedList,
14
15
  collection: true
15
16
  attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
@@ -7,7 +7,8 @@ module Metanorma
7
7
  class VerbalDefinition < Lutaml::Model::Serializable
8
8
  attribute :id, :string
9
9
  attribute :semx_id, :string
10
- attribute :p, RawParagraph, collection: true
10
+ attribute :p, Metanorma::Document::Components::Paragraphs::ParagraphBlock,
11
+ collection: true
11
12
  attribute :ol, Metanorma::Document::Components::Lists::OrderedList,
12
13
  collection: true
13
14
  attribute :ul, Metanorma::Document::Components::Lists::UnorderedList,
@@ -6,7 +6,6 @@ module Metanorma
6
6
  autoload :Blocks, "metanorma/iso_document/blocks"
7
7
  autoload :Boilerplate, "metanorma/iso_document/boilerplate"
8
8
  autoload :Metadata, "metanorma/iso_document/metadata"
9
- autoload :RawParagraph, "metanorma/iso_document/raw_paragraph"
10
9
  autoload :Root, "metanorma/iso_document/root"
11
10
  autoload :Sections, "metanorma/iso_document/sections"
12
11
  autoload :Terms, "metanorma/iso_document/terms"
@@ -4,7 +4,7 @@ module Metanorma
4
4
  module JisDocument
5
5
  module Sections
6
6
  class JisAnnexSection < Metanorma::IsoDocument::Sections::IsoAnnexSection
7
- attribute :commentary, :string
7
+ attribute :commentary, :boolean
8
8
 
9
9
  xml do
10
10
  element "annex"
@@ -3,11 +3,34 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  class AnnotationContainer < Lutaml::Model::Serializable
6
- attribute :content, :string
6
+ class Annotation < Lutaml::Model::Serializable
7
+ attribute :id, :string
8
+ attribute :reviewer, :string
9
+ attribute :from, :string
10
+ attribute :to, :string
11
+ attribute :type, :string
12
+ attribute :date, :string
13
+ attribute :paragraphs,
14
+ Metanorma::Document::Components::Paragraphs::ParagraphBlock,
15
+ collection: true
16
+
17
+ xml do
18
+ element "annotation"
19
+ map_attribute "id", to: :id
20
+ map_attribute "reviewer", to: :reviewer
21
+ map_attribute "from", to: :from
22
+ map_attribute "to", to: :to
23
+ map_attribute "type", to: :type
24
+ map_attribute "date", to: :date
25
+ map_element "p", to: :paragraphs
26
+ end
27
+ end
28
+
29
+ attribute :annotations, Annotation, collection: true
7
30
 
8
31
  xml do
9
32
  element "annotation-container"
10
- map_all_content to: :content
33
+ map_element "annotation", to: :annotations
11
34
  end
12
35
  end
13
36
  end
@@ -51,6 +51,48 @@ module Metanorma
51
51
  end
52
52
  end
53
53
 
54
+ # Provides `blocks` method for ordered-content section types.
55
+ # Returns child nodes in document order via `each_mixed_content`.
56
+ module OrderedContent
57
+ def blocks
58
+ @blocks ||=
59
+ begin
60
+ result = []
61
+ each_mixed_content do |node|
62
+ result << node unless node.is_a?(String)
63
+ end
64
+ result
65
+ end
66
+ end
67
+ end
68
+
69
+ # Presentation/formatting attributes shared by all section types.
70
+ # Include in any section class that supports presentation metadata.
71
+ module PresentationAttributes
72
+ def self.included(base)
73
+ base.class_eval do
74
+ attribute :anchor, :string
75
+ attribute :semx_id, :string
76
+ attribute :autonum, :string
77
+ attribute :displayorder, :integer
78
+ attribute :fmt_title,
79
+ Metanorma::Document::Components::Inline::FmtTitleElement
80
+ attribute :fmt_xref_label,
81
+ Metanorma::Document::Components::Inline::FmtXrefLabelElement,
82
+ collection: true
83
+ attribute :variant_title,
84
+ Metanorma::Document::Components::Inline::VariantTitleElement,
85
+ collection: true
86
+ attribute :fmt_annotation_start,
87
+ Metanorma::Document::Components::Inline::FmtAnnotationStartElement,
88
+ collection: true
89
+ attribute :fmt_annotation_end,
90
+ Metanorma::Document::Components::Inline::FmtAnnotationEndElement,
91
+ collection: true
92
+ end
93
+ end
94
+ end
95
+
54
96
  # Adds XML element mappings for block-level content to a mapping builder.
55
97
  # Call inside an `xml do` block:
56
98
  #
@@ -4,12 +4,30 @@ module Metanorma
4
4
  module StandardDocument
5
5
  module Blocks
6
6
  # Content block for amend description and new-content elements.
7
- # Uses map_all_content to preserve all children (p, ol, ul, table, etc.)
7
+ # Contains block-level content: paragraphs, notes, lists, tables, etc.
8
8
  class AmendContentBlock < Lutaml::Model::Serializable
9
- attribute :content, :string
9
+ attribute :paragraphs,
10
+ Metanorma::Document::Components::Paragraphs::ParagraphBlock,
11
+ collection: true
12
+ attribute :note,
13
+ Metanorma::Document::Components::Blocks::NoteBlock,
14
+ collection: true
15
+ attribute :ol,
16
+ Metanorma::Document::Components::Lists::OrderedList,
17
+ collection: true
18
+ attribute :ul,
19
+ Metanorma::Document::Components::Lists::UnorderedList,
20
+ collection: true
21
+ attribute :dl,
22
+ Metanorma::Document::Components::Lists::DefinitionList,
23
+ collection: true
10
24
 
11
25
  xml do
12
- map_all_content to: :content
26
+ map_element "p", to: :paragraphs
27
+ map_element "note", to: :note
28
+ map_element "ol", to: :ol
29
+ map_element "ul", to: :ul
30
+ map_element "dl", to: :dl
13
31
  end
14
32
  end
15
33
  end
@@ -4,8 +4,8 @@ module Metanorma
4
4
  module StandardDocument
5
5
  module Blocks
6
6
  class StandardBlockNoNotes < Metanorma::Document::Components::Blocks::BasicBlockNoNotes
7
- attribute :keep_with_next, :string
8
- attribute :keep_lines_together, :string
7
+ attribute :keep_with_next, :boolean
8
+ attribute :keep_lines_together, :boolean
9
9
  attribute :tag, :string
10
10
  attribute :multilingual_rendering, :string
11
11
  attribute :columns, :string
@@ -3,11 +3,29 @@
3
3
  module Metanorma
4
4
  module StandardDocument
5
5
  class Boilerplate < Lutaml::Model::Serializable
6
- attribute :content, :string
6
+ attribute :copyright_statement,
7
+ Metanorma::StandardDocument::Sections::ContentSection,
8
+ collection: true
9
+ attribute :license_statement,
10
+ Metanorma::StandardDocument::Sections::ContentSection,
11
+ collection: true
12
+ attribute :legal_statement,
13
+ Metanorma::StandardDocument::Sections::ContentSection,
14
+ collection: true
15
+ attribute :feedback_statement,
16
+ Metanorma::StandardDocument::Sections::ContentSection,
17
+ collection: true
18
+ attribute :clause,
19
+ Metanorma::StandardDocument::Sections::ContentSection,
20
+ collection: true
7
21
 
8
22
  xml do
9
23
  element "boilerplate"
10
- map_all_content to: :content
24
+ map_element "copyright-statement", to: :copyright_statement
25
+ map_element "license-statement", to: :license_statement
26
+ map_element "legal-statement", to: :legal_statement
27
+ map_element "feedback-statement", to: :feedback_statement
28
+ map_element "clause", to: :clause
11
29
  end
12
30
  end
13
31
  end
@@ -12,17 +12,23 @@ module Metanorma
12
12
  # Uses `ordered` to enable `each_mixed_content` for document-order iteration.
13
13
  class AnnexSection < Lutaml::Model::Serializable
14
14
  include Metanorma::StandardDocument::BlockAttributes
15
+ include Metanorma::StandardDocument::PresentationAttributes
16
+ include Metanorma::StandardDocument::OrderedContent
15
17
 
16
18
  # Section identity and classification
17
19
  attribute :id, :string
18
20
  attribute :number, :string
19
21
  attribute :obligation, :string
20
- attribute :unnumbered, :string
22
+ attribute :unnumbered, :boolean
21
23
  attribute :toc, :string
22
- attribute :inline_header, :string
24
+ attribute :inline_header, :boolean
23
25
  attribute :title,
24
26
  Metanorma::Document::Components::Inline::TitleWithAnnotationElement
25
27
 
28
+ # Language/script (unique to annex)
29
+ attribute :language, :string
30
+ attribute :script, :string
31
+
26
32
  # Sub-clauses within annex (recursive)
27
33
  attribute :clause, AnnexSection, collection: true
28
34
 
@@ -50,28 +56,6 @@ module Metanorma
50
56
  Metanorma::Document::Components::EmptyElements::PageBreakElement,
51
57
  collection: true
52
58
 
53
- # Presentation-specific attributes
54
- attribute :anchor, :string
55
- attribute :semx_id, :string
56
- attribute :autonum, :string
57
- attribute :displayorder, :integer
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
74
-
75
59
  xml do
76
60
  element "annex"
77
61
  ordered
@@ -79,18 +63,6 @@ module Metanorma
79
63
  Metanorma::StandardDocument::SectionXmlMapping.apply_annex_attributes(self)
80
64
  Metanorma::StandardDocument::SectionXmlMapping.apply_annex_elements(self)
81
65
  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
93
- end
94
66
  end
95
67
  end
96
68
  end
@@ -14,7 +14,7 @@ module Metanorma
14
14
  attribute :original_id, :string
15
15
  attribute :autonum, :string
16
16
  attribute :displayorder, :integer
17
- attribute :inline_header, :string
17
+ attribute :inline_header, :boolean
18
18
 
19
19
  xml do
20
20
  element "clause-hierarchical-section"
@@ -12,14 +12,16 @@ module Metanorma
12
12
  # Uses `ordered` to enable `each_mixed_content` for document-order iteration.
13
13
  class ClauseSection < Lutaml::Model::Serializable
14
14
  include Metanorma::StandardDocument::BlockAttributes
15
+ include Metanorma::StandardDocument::PresentationAttributes
16
+ include Metanorma::StandardDocument::OrderedContent
15
17
 
16
18
  # Section identity and classification
17
19
  attribute :id, :string
18
20
  attribute :type, :string
19
21
  attribute :number, :string
20
22
  attribute :obligation, :string
21
- attribute :inline_header, :string
22
- attribute :unnumbered, :string
23
+ attribute :inline_header, :boolean
24
+ attribute :unnumbered, :boolean
23
25
  attribute :toc, :string
24
26
  attribute :class_attr, :string
25
27
  attribute :title,
@@ -76,26 +78,6 @@ module Metanorma
76
78
  Metanorma::Document::Components::IdElements::Bookmark,
77
79
  collection: true
78
80
 
79
- # Presentation-specific attributes
80
- attribute :anchor, :string
81
- attribute :semx_id, :string
82
- attribute :autonum, :string
83
- attribute :displayorder, :integer
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
98
-
99
81
  xml do
100
82
  element "clause"
101
83
  ordered
@@ -103,18 +85,6 @@ module Metanorma
103
85
  Metanorma::StandardDocument::SectionXmlMapping.apply_clause_attributes(self)
104
86
  Metanorma::StandardDocument::SectionXmlMapping.apply_clause_elements(self)
105
87
  end
106
-
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
117
- end
118
88
  end
119
89
  end
120
90
  end
@@ -14,13 +14,14 @@ module Metanorma
14
14
  # definitions*
15
15
  # }
16
16
  class DefinitionSection < Lutaml::Model::Serializable
17
+ include Metanorma::StandardDocument::PresentationAttributes
18
+
17
19
  attribute :id, :string
18
- attribute :anchor, :string
19
20
  attribute :type, :string
20
21
  attribute :number, :string
21
22
  attribute :obligation, :string
22
- attribute :inline_header, :string
23
- attribute :unnumbered, :string
23
+ attribute :inline_header, :boolean
24
+ attribute :unnumbered, :boolean
24
25
  attribute :toc, :string
25
26
  attribute :class_attr, :string
26
27
  attribute :title,
@@ -46,31 +47,24 @@ module Metanorma
46
47
  # Recursive definitions
47
48
  attribute :definitions, DefinitionSection, collection: true
48
49
 
49
- # Presentation-specific attributes
50
- attribute :semx_id, :string
51
- attribute :autonum, :string
52
- attribute :displayorder, :integer
53
- attribute :fmt_title,
54
- Metanorma::Document::Components::Inline::FmtTitleElement
55
- attribute :fmt_xref_label,
56
- Metanorma::Document::Components::Inline::FmtXrefLabelElement,
57
- collection: true
58
-
59
50
  xml do
60
51
  element "definitions"
61
52
  ordered
62
53
 
63
54
  Metanorma::StandardDocument::SectionXmlMapping.apply_content_section_attributes(self)
64
55
 
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
56
+ map_element "title", to: :title
57
+ map_element "variant-title", to: :variant_title
58
+ map_element "p", to: :paragraphs
59
+ map_element "ul", to: :unordered_lists
60
+ map_element "table", to: :tables
61
+ map_element "dl", to: :definition_lists
62
+ map_element "example", to: :examples
63
+ map_element "definitions", to: :definitions
64
+ map_element "fmt-title", to: :fmt_title
73
65
  map_element "fmt-xref-label", to: :fmt_xref_label
66
+ map_element "fmt-annotation-start", to: :fmt_annotation_start
67
+ map_element "fmt-annotation-end", to: :fmt_annotation_end
74
68
  end
75
69
  end
76
70
  end