Class: AsciidoctorBibliography::CitationItem
- Inherits:
-
Object
- Object
- AsciidoctorBibliography::CitationItem
- Defined in:
- lib/asciidoctor-bibliography/citation_item.rb
Constant Summary collapse
- LOCATORS =
CiteProc::CitationItem.labels.map(&:to_s).push("locator").freeze
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#named_attributes ⇒ Object
Returns the value of attribute named_attributes.
-
#positional_attributes ⇒ Object
Returns the value of attribute positional_attributes.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ CitationItem
constructor
A new instance of CitationItem.
- #locator ⇒ Object
- #locators ⇒ Object
- #parse_attribute_list(string) ⇒ Object
- #prefix ⇒ Object
- #suffix ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ CitationItem
Returns a new instance of CitationItem.
9 10 11 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 9 def initialize yield self if block_given? end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
7 8 9 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 7 def key @key end |
#named_attributes ⇒ Object
Returns the value of attribute named_attributes.
7 8 9 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 7 def named_attributes @named_attributes end |
#positional_attributes ⇒ Object
Returns the value of attribute positional_attributes.
7 8 9 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 7 def positional_attributes @positional_attributes end |
#target ⇒ Object
Returns the value of attribute target.
7 8 9 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 7 def target @target end |
Instance Method Details
#locator ⇒ Object
29 30 31 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 29 def locator locators.first end |
#locators ⇒ Object
25 26 27 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 25 def locators named_attributes.select { |key, _| LOCATORS.include? key } end |
#parse_attribute_list(string) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 33 def parse_attribute_list(string) parsed_attributes = ::Asciidoctor::AttributeList.new(string).parse self.named_attributes = parsed_attributes.reject { |key, _| key.is_a? Integer } self.positional_attributes = parsed_attributes.select { |key, _| key.is_a? Integer }.values self.key = positional_attributes.shift end |
#prefix ⇒ Object
13 14 15 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 13 def prefix named_attributes["prefix"] end |
#suffix ⇒ Object
17 18 19 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 17 def suffix named_attributes["suffix"] end |
#text ⇒ Object
21 22 23 |
# File 'lib/asciidoctor-bibliography/citation_item.rb', line 21 def text named_attributes["text"] end |