Class: Metanorma::Iso::Sts::Transformer::Context
- Inherits:
-
Object
- Object
- Metanorma::Iso::Sts::Transformer::Context
- Defined in:
- lib/metanorma/iso/sts/transformer/context.rb
Instance Attribute Summary collapse
-
#footnote_collector ⇒ Object
readonly
Returns the value of attribute footnote_collector.
-
#id_generator ⇒ Object
readonly
Returns the value of attribute id_generator.
-
#source_document ⇒ Object
readonly
Returns the value of attribute source_document.
Instance Method Summary collapse
- #bibitem_lookup ⇒ Object
- #doctype ⇒ Object
-
#initialize(source_document) ⇒ Context
constructor
A new instance of Context.
- #language ⇒ Object
- #script ⇒ Object
Constructor Details
#initialize(source_document) ⇒ Context
Returns a new instance of Context.
9 10 11 12 13 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 9 def initialize(source_document) @source_document = source_document @id_generator = Transformer::IdGenerator.new(self) @footnote_collector = Transformer::FootnoteCollector.new end |
Instance Attribute Details
#footnote_collector ⇒ Object (readonly)
Returns the value of attribute footnote_collector.
7 8 9 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 7 def footnote_collector @footnote_collector end |
#id_generator ⇒ Object (readonly)
Returns the value of attribute id_generator.
7 8 9 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 7 def id_generator @id_generator end |
#source_document ⇒ Object (readonly)
Returns the value of attribute source_document.
7 8 9 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 7 def source_document @source_document end |
Instance Method Details
#bibitem_lookup ⇒ Object
40 41 42 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 40 def bibitem_lookup @bibitem_lookup ||= build_bibitem_lookup end |
#doctype ⇒ Object
35 36 37 38 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 35 def doctype bibdata = @source_document.bibdata bibdata&.ext&.doctype end |
#language ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 15 def language return nil unless @source_document bibdata = @source_document.bibdata return nil unless bibdata lang = bibdata.language lang.is_a?(Array) ? lang.first : lang end |
#script ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/metanorma/iso/sts/transformer/context.rb', line 25 def script return nil unless @source_document bibdata = @source_document.bibdata return nil unless bibdata scr = bibdata.script scr.is_a?(Array) ? scr.first : scr end |