Adds "Download in RIS format" functionality to Blacklight
Add this line to your application's Gemfile:
gem 'blacklight-ris', :git => 'https://github.com/upenn-libraries/blacklight-ris.git'
And then execute:
$ bundle install
Modify your SolrDocument
class with the extension modules for RIS,
and define your field mappings using the ris_field_mappings
hash.
class SolrDocument
# ...existing code...
include Blacklight::Solr::Document::RisFields
use_extension(Blacklight::Solr::Document::RisExport)
ris_field_mappings.merge!(
# Procs are evaluated in context of SolrDocument instance
:TY => Proc.new {
format = fetch('format_a', [])
if format.member?('Book')
'BOOK'
elsif format.member?('Journal/Periodical')
'JOUR'
else
'GEN'
end
},
# use solr field named 'title'
:TI => 'title',
:AU => 'author_creator_a',
:PY => 'publication_date_a',
# this assumes you're using blacklight-marc
:CY => Proc.new { marclibrary.get_ris_cy_field(to_marc) },
:PB => Proc.new { marclibrary.get_ris_pb_field(to_marc) },
:ET => 'edition',
:SN => Proc.new { marclibrary.get_ris_sn_field(to_marc) },
)
end
Modify your CatalogController
to include the
Blacklight::Ris::Catalog
module. Put this at the end of any existing
includes.
class CatalogController < ApplicationController
# ...existing includes...
include Blacklight::Catalog
# add this line
include Blacklight::Ris::Catalog
end
The show view and bookmarks page should now display links for downloading records in RIS format.
The gem is available as open source under the terms of the MIT License.