Skip to content

A Rails engine for Blacklight that adds support for downloading records in RIS format

License

Notifications You must be signed in to change notification settings

upenn-libraries/blacklight-ris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blacklight-ris

Adds "Download in RIS format" functionality to Blacklight

Installation

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

Usage

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.

License

The gem is available as open source under the terms of the MIT License.

About

A Rails engine for Blacklight that adds support for downloading records in RIS format

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published