Module: Metanorma::StandardDocument::SectionXmlMapping
- Defined in:
- lib/metanorma/standard_document/block_attributes.rb
Overview
Shared XML mapping helpers for section-level elements. Extracts the common attribute/element mappings duplicated across ClauseSection, AnnexSection, and their flavor-specific subclasses.
Class Method Summary collapse
-
.apply_annex_attributes(mapping) ⇒ Object
Common XML attribute mappings for annex sections.
-
.apply_annex_elements(mapping) ⇒ Object
Common XML element mappings for annex sections.
-
.apply_clause_attributes(mapping) ⇒ Object
Common XML attribute mappings for clause sections.
-
.apply_clause_elements(mapping) ⇒ Object
Common XML element mappings for clause sections.
-
.apply_content_section_attributes(mapping) ⇒ Object
Common XML attribute/element mappings for ContentSection subclasses.
- .apply_content_section_elements(mapping) ⇒ Object
- .apply_preface_attributes(mapping) ⇒ Object
-
.apply_preface_elements(mapping) ⇒ Object
Common XML element/attribute mappings for preface containers.
- .apply_sections_attributes(mapping) ⇒ Object
-
.apply_sections_elements(mapping) ⇒ Object
Common XML element/attribute mappings for the sections container.
Class Method Details
.apply_annex_attributes(mapping) ⇒ Object
Common XML attribute mappings for annex sections.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 132 def self.apply_annex_attributes(mapping) mapping.map_attribute "id", to: :id mapping.map_attribute "number", to: :number mapping.map_attribute "obligation", to: :obligation, render_empty: true mapping.map_attribute "unnumbered", to: :unnumbered mapping.map_attribute "toc", to: :toc mapping.map_attribute "anchor", to: :anchor mapping.map_attribute "semx-id", to: :semx_id mapping.map_attribute "autonum", to: :autonum mapping.map_attribute "displayorder", to: :displayorder mapping.map_attribute "inline-header", to: :inline_header mapping.map_attribute "language", to: :language, render_empty: true mapping.map_attribute "script", to: :script, render_empty: true end |
.apply_annex_elements(mapping) ⇒ Object
Common XML element mappings for annex sections.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 149 def self.apply_annex_elements(mapping) mapping.map_element "title", to: :title mapping.map_element "variant-title", to: :variant_title mapping.map_element "fmt-title", to: :fmt_title mapping.map_element "fmt-xref-label", to: :fmt_xref_label BlockXmlMapping.apply_block_mappings(mapping) mapping.map_element "clause", to: :clause mapping.map_element "appendix", to: :appendix mapping.map_element "terms", to: :terms mapping.map_element "definitions", to: :definitions mapping.map_element "references", to: :references mapping.map_element "floating-title", to: :floating_title mapping.map_element "pagebreak", to: :pagebreak mapping.map_element "fmt-annotation-start", to: :fmt_annotation_start mapping.map_element "fmt-annotation-end", to: :fmt_annotation_end end |
.apply_clause_attributes(mapping) ⇒ Object
Common XML attribute mappings for clause sections.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 91 def self.apply_clause_attributes(mapping) mapping.map_attribute "id", to: :id mapping.map_attribute "anchor", to: :anchor mapping.map_attribute "type", to: :type mapping.map_attribute "number", to: :number mapping.map_attribute "obligation", to: :obligation mapping.map_attribute "inline-header", to: :inline_header mapping.map_attribute "unnumbered", to: :unnumbered mapping.map_attribute "toc", to: :toc mapping.map_attribute "class", to: :class_attr mapping.map_attribute "semx-id", to: :semx_id mapping.map_attribute "autonum", to: :autonum mapping.map_attribute "displayorder", to: :displayorder end |
.apply_clause_elements(mapping) ⇒ Object
Common XML element mappings for clause sections.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 107 def self.apply_clause_elements(mapping) mapping.map_element "title", to: :title mapping.map_element "variant-title", to: :variant_title mapping.map_element "fmt-title", to: :fmt_title mapping.map_element "fmt-xref-label", to: :fmt_xref_label BlockXmlMapping.apply_block_mappings(mapping) mapping.map_element "amend", to: :amend mapping.map_element "clause", to: :clause mapping.map_element "terms", to: :terms mapping.map_element "definitions", to: :definitions mapping.map_element "references", to: :references mapping.map_element "floating-title", to: :floating_title mapping.map_element "form", to: :form mapping.map_element "requirement", to: :requirement mapping.map_element "recommendation", to: :recommendation mapping.map_element "permission", to: :permission mapping.map_element "pagebreak", to: :pagebreak mapping.map_element "bookmark", to: :bookmark mapping.map_element "fmt-annotation-start", to: :fmt_annotation_start mapping.map_element "fmt-annotation-end", to: :fmt_annotation_end end |
.apply_content_section_attributes(mapping) ⇒ Object
Common XML attribute/element mappings for ContentSection subclasses.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 197 def self.apply_content_section_attributes(mapping) mapping.map_attribute "id", to: :id mapping.map_attribute "anchor", to: :anchor mapping.map_attribute "type", to: :type mapping.map_attribute "number", to: :number mapping.map_attribute "obligation", to: :obligation mapping.map_attribute "inline-header", to: :inline_header mapping.map_attribute "unnumbered", to: :unnumbered mapping.map_attribute "toc", to: :toc mapping.map_attribute "class", to: :class_attr mapping.map_attribute "semx-id", to: :semx_id mapping.map_attribute "autonum", to: :autonum mapping.map_attribute "displayorder", to: :displayorder end |
.apply_content_section_elements(mapping) ⇒ Object
212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 212 def self.apply_content_section_elements(mapping) mapping.map_element "title", to: :title mapping.map_element "variant-title", to: :variant_title mapping.map_element "fmt-title", to: :fmt_title mapping.map_element "fmt-xref-label", to: :fmt_xref_label BlockXmlMapping.apply_block_mappings(mapping) mapping.map_element "clause", to: :subsection mapping.map_element "fmt-annotation-start", to: :fmt_annotation_start mapping.map_element "fmt-annotation-end", to: :fmt_annotation_end end |
.apply_preface_attributes(mapping) ⇒ Object
191 192 193 194 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 191 def self.apply_preface_attributes(mapping) mapping.map_attribute "semx-id", to: :semx_id mapping.map_attribute "displayorder", to: :displayorder end |
.apply_preface_elements(mapping) ⇒ Object
Common XML element/attribute mappings for preface containers.
183 184 185 186 187 188 189 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 183 def self.apply_preface_elements(mapping) mapping.map_element "abstract", to: :abstract mapping.map_element "foreword", to: :foreword mapping.map_element "introduction", to: :introduction mapping.map_element "acknowledgements", to: :acknowledgements mapping.map_element "executivesummary", to: :executivesummary end |
.apply_sections_attributes(mapping) ⇒ Object
177 178 179 180 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 177 def self.apply_sections_attributes(mapping) mapping.map_attribute "semx-id", to: :semx_id mapping.map_attribute "displayorder", to: :displayorder end |
.apply_sections_elements(mapping) ⇒ Object
Common XML element/attribute mappings for the sections container.
169 170 171 172 173 174 175 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 169 def self.apply_sections_elements(mapping) mapping.map_element "clause", to: :clause mapping.map_element "terms", to: :terms mapping.map_element "definitions", to: :definitions mapping.map_element "floating-title", to: :floating_title mapping.map_element "references", to: :references end |