Module: Metanorma::Document::Components::Inline::Vocabulary::VocabularyXmlMapping

Defined in:
lib/metanorma/document/components/inline/vocabulary.rb

Overview

Adds the map_element calls corresponding to every vocabulary attribute. Call inside an xml do ... end block:

xml do
element "span"
mixed_content
map_attribute "class", to: :class_attr
map_content to: :text
VocabularyXmlMapping.apply_inline_mappings(self)
end

Constant Summary collapse

INLINE_MAPPINGS =
{
  "semx" => :semx,
  "em" => :em,
  "strong" => :strong,
  "sub" => :sub,
  "sup" => :sup,
  "tt" => :tt,
  "underline" => :underline,
  "strike" => :strike,
  "smallcap" => :smallcap,
  "br" => :br,
  "tab" => :tab,
  "xref" => :xref,
  "eref" => :eref,
  "link" => :link,
  "span" => :span,
  "stem" => :stem,
  "concept" => :concept,
  "fn" => :fn,
  "bcp14" => :bcp14,
  "bookmark" => :bookmark,
  "image" => :image,
  "index" => :index,
  "add" => :add,
  "del" => :del,
  "fmt-stem" => :fmt_stem,
  "fmt-concept" => :fmt_concept,
  "fmt-fn-label" => :fmt_fn_label,
  "fmt-annotation-start" => :fmt_annotation_start,
  "fmt-annotation-end" => :fmt_annotation_end,
}.freeze

Class Method Summary collapse

Class Method Details

.apply_inline_mappings(mapping) ⇒ Object



174
175
176
177
178
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 174

def self.apply_inline_mappings(mapping)
  INLINE_MAPPINGS.each do |element_name, attr_name|
    mapping.map_element(element_name, to: attr_name)
  end
end