Module: Metanorma::Document::Components::Inline::Vocabulary
- Included in:
- SpanElement, StandardDocument::Terms::TermNameElement
- Defined in:
- lib/metanorma/document/components/inline/vocabulary.rb
Overview
Shared vocabulary of inline child elements that may appear in any
general-purpose inline-content container. Including this module
in a Lutaml::Model::Serializable subclass declares every inline
element type as a collection attribute, so that no inline child
encountered during parsing is silently dropped.
Use together with VocabularyXmlMapping.apply_inline_mappings
inside the class's xml do ... end block.
Restricted child sets (e.g. XrefElement with only <location>
children) intentionally do NOT include this module — they have
semantic reasons to exclude the general vocabulary.
Defined Under Namespace
Modules: VocabularyXmlMapping
Class Method Summary collapse
- .declare_cross_reference_attributes_on(base) ⇒ Object
- .declare_formatting_attributes_on(base) ⇒ Object
- .declare_rendered_display_attributes_on(base) ⇒ Object
- .declare_structural_attributes_on(base) ⇒ Object
- .declare_text_attributes_on(base) ⇒ Object
- .included(base) ⇒ Object
Class Method Details
.declare_cross_reference_attributes_on(base) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 63 def declare_cross_reference_attributes_on(base) base.attribute :xref, Metanorma::Document::Components::Inline::XrefElement, collection: true base.attribute :eref, Metanorma::Document::Components::Inline::ErefElement, collection: true base.attribute :link, Metanorma::Document::Components::Inline::LinkElement, collection: true base.attribute :span, Metanorma::Document::Components::Inline::SpanElement, collection: true end |
.declare_formatting_attributes_on(base) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 36 def declare_formatting_attributes_on(base) base.attribute :em, Metanorma::Document::Components::Inline::EmRawElement, collection: true base.attribute :strong, Metanorma::Document::Components::Inline::StrongRawElement, collection: true base.attribute :sub, Metanorma::Document::Components::Inline::SubElement, collection: true base.attribute :sup, Metanorma::Document::Components::Inline::SupElement, collection: true base.attribute :tt, Metanorma::Document::Components::Inline::TtElement, collection: true base.attribute :underline, Metanorma::Document::Components::TextElements::UnderlineElement, collection: true base.attribute :strike, Metanorma::Document::Components::TextElements::StrikeElement, collection: true base.attribute :smallcap, Metanorma::Document::Components::Inline::SmallCapElement, collection: true end |
.declare_rendered_display_attributes_on(base) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 112 def declare_rendered_display_attributes_on(base) base.attribute :fmt_stem, Metanorma::Document::Components::Inline::FmtStemElement, collection: true base.attribute :fmt_concept, Metanorma::Document::Components::Inline::FmtConceptElement, collection: true base.attribute :fmt_fn_label, Metanorma::Document::Components::Inline::FmtFnLabelElement, collection: true base.attribute :fmt_annotation_start, Metanorma::Document::Components::Inline::FmtAnnotationStartElement, collection: true base.attribute :fmt_annotation_end, Metanorma::Document::Components::Inline::FmtAnnotationEndElement, collection: true end |
.declare_structural_attributes_on(base) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 78 def declare_structural_attributes_on(base) base.attribute :stem, Metanorma::Document::Components::Inline::StemInlineElement, collection: true base.attribute :concept, Metanorma::Document::Components::Inline::ConceptElement, collection: true base.attribute :fn, Metanorma::Document::Components::Inline::FnElement, collection: true base.attribute :bcp14, Metanorma::Document::Components::Inline::Bcp14Element, collection: true base.attribute :br, Metanorma::Document::Components::Inline::BrElement, collection: true base.attribute :tab, Metanorma::Document::Components::Inline::TabElement, collection: true base.attribute :bookmark, Metanorma::Document::Components::IdElements::Bookmark, collection: true base.attribute :image, Metanorma::Document::Components::IdElements::Image, collection: true base.attribute :index, Metanorma::Document::Components::EmptyElements::IndexElement, collection: true base.attribute :add, "Metanorma::Document::Elements::Add", collection: true base.attribute :del, "Metanorma::Document::Elements::Del", collection: true end |
.declare_text_attributes_on(base) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 29 def declare_text_attributes_on(base) base.attribute :text, :string, collection: true base.attribute :semx, Metanorma::Document::Components::Inline::SemxElement, collection: true end |
.included(base) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/metanorma/document/components/inline/vocabulary.rb', line 20 def self.included(base) declare_text_attributes_on(base) declare_formatting_attributes_on(base) declare_cross_reference_attributes_on(base) declare_structural_attributes_on(base) declare_rendered_display_attributes_on(base) end |