Class: Coradoc::Element::BibliographyEntry
- Defined in:
- lib/coradoc/element/bibliography_entry.rb
Instance Attribute Summary collapse
-
#anchor_name ⇒ Object
Returns the value of attribute anchor_name.
-
#document_id ⇒ Object
Returns the value of attribute document_id.
-
#line_break ⇒ Object
Returns the value of attribute line_break.
-
#ref_text ⇒ Object
Returns the value of attribute ref_text.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BibliographyEntry
constructor
A new instance of BibliographyEntry.
- #to_adoc ⇒ Object
Methods inherited from Base
#children_accessors, children_accessors, declare_children, #simplify_block_content, visit, #visit
Constructor Details
#initialize(options = {}) ⇒ BibliographyEntry
Returns a new instance of BibliographyEntry.
6 7 8 9 10 11 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 6 def initialize( = {}) @anchor_name = .fetch(:anchor_name, nil) @document_id = .fetch(:document_id, nil) @ref_text = .fetch(:ref_text, nil) @line_break = .fetch(:line_break, "") end |
Instance Attribute Details
#anchor_name ⇒ Object
Returns the value of attribute anchor_name.
4 5 6 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 4 def anchor_name @anchor_name end |
#document_id ⇒ Object
Returns the value of attribute document_id.
4 5 6 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 4 def document_id @document_id end |
#line_break ⇒ Object
Returns the value of attribute line_break.
4 5 6 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 4 def line_break @line_break end |
#ref_text ⇒ Object
Returns the value of attribute ref_text.
4 5 6 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 4 def ref_text @ref_text end |
Instance Method Details
#to_adoc ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/coradoc/element/bibliography_entry.rb', line 13 def to_adoc text = Coradoc::Generator.gen_adoc(@ref_text) if @ref_text adoc = "* [[[#{@anchor_name}" adoc << ",#{@document_id}" if @document_id adoc << "]]]" adoc << "#{text}" if @ref_text adoc << @line_break adoc end |