25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'app/models/concerns/blacklight/document/bibtex.rb', line 25
def export_as_bibtex
config = ::CatalogController.blacklight_config.citeproc
entry = ::BibTeX::Entry.new
entry.type = :book
entry.key = id
entry.title = first config[:fields][:title]
multiple_valued_fields = %i[author editor]
multiple_valued_fields.each do |field|
entry.send("#{field}=", fetch(config[:fields][field])) if has? config[:fields][field]
end
single_valued_fields = %i[address annote booktitle chapter doi edition how_published institution
journal key month note number organization pages publisher school series url volume year]
single_valued_fields.each do |field|
entry.send("#{field}=", first(config[:fields][field])) if has? config[:fields][field]
end
entry
end
|