class AsciidoctorBibliography::Bibliographer
Attributes
citations[RW]
database[RW]
indices[RW]
occurring_keys[R]
options[RW]
Public Class Methods
new()
click to toggle source
# File lib/asciidoctor-bibliography/bibliographer.rb, line 9 def initialize @options = {} @citations = [] @indices = [] @database = nil @occurring_keys = {} end
Public Instance Methods
add_citation(citation)
click to toggle source
# File lib/asciidoctor-bibliography/bibliographer.rb, line 17 def add_citation(citation) citations << citation # NOTE: Since we're rendering the whole (possibly composite) citation as missing - even if # NOTE: a single key is nil - we add none of them to the occurring keys to be rendered in indices. return if citation.any_missing_id?(self) citation.citation_items.group_by(&:target).each do |target, citation_items| @occurring_keys[target] ||= [] @occurring_keys[target].concat(citation_items.map(&:key)).uniq! end end
appearance_index_of(target, id)
click to toggle source
# File lib/asciidoctor-bibliography/bibliographer.rb, line 30 def appearance_index_of(target, id) @occurring_keys[target].index(id) + 1 end