Sha256: 59c59a5d28d930affb20f5dd1135c6233bdb91547562fb7886b6802f03836d3a
Contents?: true
Size: 719 Bytes
Versions: 1
Compression:
Stored size: 719 Bytes
Contents
module AsciidoctorBibliography class Bibliographer attr_accessor :citations attr_accessor :indices attr_accessor :database attr_reader :occurring_keys attr_accessor :options def initialize @options = {} @citations = [] @indices = [] @database = nil @occurring_keys = Hash.new([]) end def add_citation(citation) citations << citation 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 def appearance_index_of(target, id) @occurring_keys[target].index(id) + 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asciidoctor-bibliography-0.5.0 | lib/asciidoctor-bibliography/bibliographer.rb |