lib/bibtex/entry/citeproc_converter.rb in bibtex-ruby-4.2.0 vs lib/bibtex/entry/citeproc_converter.rb in bibtex-ruby-4.3.0
- old
+ new
@@ -60,19 +60,15 @@
def convert!
bibtex.parse_names
bibtex.parse_month
bibtex.each_pair do |key, value|
- unless BibTeX::Entry::DATE_FIELDS.include?(key)
- cp_key = CSL_FILTER[key].to_s
+ convert key, value
+ end
- if hash.key?(cp_key)
- hash[key] = value.to_citeproc(options)
- else
- hash[cp_key] = value.to_citeproc(options)
- end
- end
+ bibtex.inherited_fields.each do |key|
+ convert key, bibtex.parent.provide(key)
end
methods = self.class.instance_methods(false) - [:convert!, :hash]
methods.each { |m| send(m) }
@@ -144,12 +140,24 @@
when :phdthesis
hash['genre'] = 'PhD thesis'
end
end
- protected
+ private
attr_reader :bibtex, :options
+
+ def convert(key, value)
+ return if BibTeX::Entry::DATE_FIELDS.include?(key)
+
+ cp_key = CSL_FILTER[key].to_s
+
+ if hash.key?(cp_key)
+ hash[key] = value.to_citeproc(options)
+ else
+ hash[cp_key] = value.to_citeproc(options)
+ end
+ end
def hash
@hash ||= {}
end
end