Module: Metanorma::StandardDocument::RootXmlMapping

Defined in:
lib/metanorma/standard_document/root_attributes.rb

Overview

Adds common XML root element mappings for all flavor Root classes. Call inside an ‘xml do` block:

xml do
  element "metanorma"
  namespace StandardDocument::Namespace
  RootXmlMapping.apply(self)
  # ... flavor-specific mappings (bibdata, preface, sections, annex)
end

Class Method Summary collapse

Class Method Details

.apply(mapping) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/metanorma/standard_document/root_attributes.rb', line 54

def self.apply(mapping)
  mapping.map_attribute "type",               to: :type
  mapping.map_attribute "version",            to: :version
  mapping.map_attribute "schema-version",     to: :schema_version
  mapping.map_attribute "flavor",             to: :flavor
  mapping.map_attribute "autonum",            to: :autonum
  mapping.map_attribute "fmt-xref-label",     to: :fmt_xref_label
  mapping.map_element   "bibdata",            to: :bibdata
  mapping.map_element   "preface",            to: :preface
  mapping.map_element   "sections",           to: :sections
  mapping.map_element   "annex",              to: :annex
  mapping.map_element   "bibliography",       to: :bibliography
  mapping.map_element   "boilerplate",        to: :boilerplate
  mapping.map_element   "metanorma-extension", to: :metanorma_extension
  mapping.map_element   "annotation-container", to: :annotation_container
  mapping.map_element   "localized-strings", to: :localized_strings
  mapping.map_element   "fmt-footnote-container",
                        to: :fmt_footnote_container
  mapping.map_element   "colophon",           to: :colophon
  mapping.map_element   "termdocsource",      to: :term_sources
  mapping.map_element   "indexsect",          to: :indexsect
end