Class: Coradoc::Element::BibliographyEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/element/bibliography_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  @anchor_name = options.fetch(:anchor_name, nil)
  @document_id = options.fetch(:document_id, nil)
  @ref_text = options.fetch(:ref_text, nil)
  @line_break = options.fetch(:line_break, "")
end

Instance Attribute Details

#anchor_nameObject

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_idObject

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_breakObject

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_textObject

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_adocObject



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