Class: Uniword::Builder::FootnoteBuilder
- Inherits:
-
Object
- Object
- Uniword::Builder::FootnoteBuilder
- Defined in:
- lib/uniword/builder/footnote_builder.rb
Overview
Builds footnotes and endnotes for documents.
Manages footnote/endnote creation, ID assignment, and wiring references into the document body.
Instance Method Summary collapse
-
#endnote(text = nil) {|ParagraphBuilder| ... } ⇒ Wordprocessingml::Run
Create an endnote and return a Run with an endnoteReference.
-
#footnote(text = nil) {|ParagraphBuilder| ... } ⇒ Wordprocessingml::Run
Create a footnote and return a Run with a footnoteReference.
-
#initialize(document) ⇒ FootnoteBuilder
constructor
A new instance of FootnoteBuilder.
Constructor Details
#initialize(document) ⇒ FootnoteBuilder
Returns a new instance of FootnoteBuilder.
17 18 19 |
# File 'lib/uniword/builder/footnote_builder.rb', line 17 def initialize(document) @document = document end |
Instance Method Details
#endnote(text = nil) {|ParagraphBuilder| ... } ⇒ Wordprocessingml::Run
Create an endnote and return a Run with an endnoteReference.
44 45 46 47 48 49 50 51 |
# File 'lib/uniword/builder/footnote_builder.rb', line 44 def endnote(text = nil, &) id = next_endnote_id run = Wordprocessingml::Run.new( endnote_reference: Wordprocessingml::EndnoteReference.new(id: id.to_s) ) create_endnote_entry(id, text, &) run end |
#footnote(text = nil) {|ParagraphBuilder| ... } ⇒ Wordprocessingml::Run
Create a footnote and return a Run with a footnoteReference.
The footnote body is stored in the document’s footnotes collection. The returned Run contains a <w:footnoteReference> element that Word uses to link to the footnote body.
30 31 32 33 34 35 36 37 |
# File 'lib/uniword/builder/footnote_builder.rb', line 30 def footnote(text = nil, &) id = next_footnote_id run = Wordprocessingml::Run.new( footnote_reference: Wordprocessingml::FootnoteReference.new(id: id.to_s) ) create_footnote_entry(id, text, &) run end |