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.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 187 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.
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 204 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.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 146 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.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 162 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.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 252 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
267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 267 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
246 247 248 249 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 246 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.
238 239 240 241 242 243 244 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 238 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
232 233 234 235 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 232 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.
224 225 226 227 228 229 230 |
# File 'lib/metanorma/standard_document/block_attributes.rb', line 224 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 |