blacklight-marc 6.1.1 → 7.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +10 -4
  3. data/Gemfile +12 -0
  4. data/README.md +28 -7
  5. data/Rakefile +0 -2
  6. data/app/assets/stylesheets/blacklight_marc.scss +4 -6
  7. data/app/helpers/blacklight_marc_helper.rb +5 -4
  8. data/app/models/concerns/blacklight/solr/document/marc.rb +13 -12
  9. data/app/models/concerns/blacklight/solr/document/marc_export.rb +53 -50
  10. data/app/views/bookmarks/_endnote.html.erb +1 -1
  11. data/app/views/bookmarks/_refworks.html.erb +1 -1
  12. data/app/views/catalog/_marc_view.html.erb +4 -4
  13. data/app/views/catalog/endnote.endnote.erb +1 -1
  14. data/app/views/catalog/librarian_view.html.erb +7 -4
  15. data/blacklight-marc.gemspec +7 -10
  16. data/config/routes.rb +1 -1
  17. data/lib/blacklight/marc/catalog.rb +9 -15
  18. data/lib/blacklight/marc/engine.rb +2 -0
  19. data/lib/blacklight/marc/indexer.rb +9 -39
  20. data/lib/blacklight/marc/indexer/formats.rb +13 -15
  21. data/lib/blacklight/marc/routes.rb +2 -39
  22. data/lib/blacklight/marc/routes/marc_viewable.rb +20 -0
  23. data/lib/blacklight/marc/version.rb +1 -1
  24. data/lib/generators/blacklight/marc/install_generator.rb +15 -8
  25. data/lib/generators/blacklight/marc/templates/app/models/marc_indexer.rb +59 -59
  26. data/lib/generators/blacklight/marc/templates/config/translation_maps/callnumber_map.properties +149 -11
  27. data/lib/railties/solr_marc.rake +33 -33
  28. data/solr/conf/schema.xml +326 -573
  29. data/solr/conf/solrconfig.xml +78 -294
  30. data/spec/controllers/catalog_controller_spec.rb +11 -6
  31. data/spec/features/bookmarks_spec.rb +2 -1
  32. data/spec/features/search_formats_spec.rb +3 -3
  33. data/spec/integration/solr_document_spec.rb +19 -19
  34. data/spec/lib/blacklight_solr_document_marc_spec.rb +7 -7
  35. data/spec/lib/indexer/dewey_spec.rb +4 -4
  36. data/spec/lib/indexer/formats_spec.rb +9 -1
  37. data/spec/lib/marc_export_spec.rb +46 -46
  38. data/spec/lib/tasks/solr_marc_task_spec.rb +7 -7
  39. data/spec/lib/traject_indexer_spec.rb +6 -2
  40. data/spec/routing/routes_spec.rb +0 -6
  41. data/spec/test_app_templates/Gemfile.extra +2 -0
  42. data/spec/test_app_templates/lib/generators/test_app_generator.rb +14 -13
  43. data/spec/views/bookmarks/_endnote.html.erb_spec.rb +16 -6
  44. data/spec/views/bookmarks/_refworks.html.erb_spec.rb +17 -7
  45. data/spec/views/catalog/index.atom.builder_spec.rb +12 -17
  46. data/test_support/config/translation_maps/test_formats.properties +3 -1
  47. metadata +23 -43
  48. data/app/helpers/blacklight_bookmarks_helper.rb +0 -3
  49. data/solr/sample_solr_documents.yml +0 -2692
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2dad28dda5b571d3d111370ddab6cdbd03bab70b
4
- data.tar.gz: 0177360550a4b9b7387790c51dd543b8c1396c4a
2
+ SHA256:
3
+ metadata.gz: 432d7a660db81b2bbeca3baec8b83caba9a5a774cc3d0e81aba21f9ed14299dd
4
+ data.tar.gz: e86995f1d734859fa0c498bc84620fa7e0452ccd48b21b78b4a2be0cc880ef06
5
5
  SHA512:
6
- metadata.gz: 82744f0a7fb2e5a2688753211de0a5fa449caca6682d7ae78eada10819828d0e0e67cd9b380339d9c1f7ba53a231dff1618f3a19618f4b67b0c01c410378dfee
7
- data.tar.gz: 283589fa380fe66a421a93a6354b9555b965ac72091dd06fd777535679a45d5fe58375cad0482ac7e38a9b41646e8bab7b381a2b4fb6dcd12b0203bccf6a35c8
6
+ metadata.gz: a088b5bc21a4ff7325e552b07ef618e5ed60a09b74ba409277b14dea661616bd6a4999d25f090505ec46644a489f4651afce800a63c47d5f9e0b09ca5c432b49
7
+ data.tar.gz: 71712bc65b078fa2ad1c32b75e5aa2cbbf98e1ac3f0a4bc3784ff13991656ced7076fe729955d607fd9679c4bc618051ad639a15b184435692b641d46e57e7e7
data/.travis.yml CHANGED
@@ -4,8 +4,14 @@ sudo: false
4
4
  notifications:
5
5
  email: false
6
6
 
7
- rvm:
8
- - 2.3.1
7
+ matrix:
8
+ include:
9
+ - rvm: 2.7.1
10
+ env: "RAILS_VERSION=6.0.3.2"
11
+ - rvm: 2.6.6
12
+ env: "RAILS_VERSION=6.0.3.2"
13
+ - rvm: 2.6.6
14
+ env: "RAILS_VERSION=5.2.4.3"
9
15
 
10
16
  before_install:
11
17
  - gem install bundler
@@ -17,5 +23,5 @@ notifications:
17
23
 
18
24
  global_env:
19
25
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
20
-
21
- jdk: oraclejdk8
26
+
27
+ jdk: openjdk11
data/Gemfile CHANGED
@@ -1,5 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ git_source(:github) do |repo_name|
4
+ repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
5
+ "https://github.com/#{repo_name}.git"
6
+ end
7
+
3
8
  # Please see blacklight_marc.gemspec for dependency information.
4
9
  gemspec path: File.expand_path('..', __FILE__)
5
10
 
@@ -28,6 +33,11 @@ else
28
33
  end
29
34
 
30
35
  case ENV['RAILS_VERSION']
36
+ when /^6.0/
37
+ gem 'sass-rails', '>= 6'
38
+ gem 'webpacker', '~> 4.0'
39
+ when /^5.[12]/
40
+ gem 'sass-rails', '~> 5.0'
31
41
  when /^4.2/
32
42
  gem 'responders', '~> 2.0'
33
43
  gem 'sass-rails', '>= 5.0'
@@ -37,3 +47,5 @@ else
37
47
  end
38
48
  end
39
49
  # END ENGINE_CART BLOCK
50
+
51
+ eval_gemfile File.expand_path("spec/test_app_templates/Gemfile.extra", File.dirname(__FILE__))
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
- [![Build Status](https://travis-ci.org/projectblacklight/blacklight_marc.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight_marc)
1
+ [![Build Status](https://travis-ci.org/projectblacklight/blacklight-marc.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight-marc)
2
2
 
3
3
  # Blacklight::Marc
4
4
 
5
5
  MARC-specific enhancements for [Blacklight](https://github.com/projectblacklight/blacklight)
6
6
 
7
+ ## Features
8
+ * Rake task `solr:marc:index` to import .mrc files using Traject and app/models/marc_indexer
9
+ * "Librarian View" at `catalog/:id/librarian_view`
10
+ * Export records to refworks and endnote
11
+ * Blacklight::Solr::Document mixins for exporting and transforming MARC data from a stored Solr field
12
+
7
13
  ## Installation
8
14
 
9
15
  Add this line to your application's Gemfile:
@@ -18,6 +24,27 @@ After running the blacklight generator, run the blacklight_marc generator:
18
24
 
19
25
  $ rails generate blacklight:marc:install
20
26
 
27
+
28
+ ## How does it work?
29
+ This generator injects an include into CatalogController (parent class of BookmarksController):
30
+
31
+ ```ruby
32
+ include Blacklight::Marc::Catalog
33
+ ```
34
+
35
+ and the following code is generated into SolrDocument:
36
+
37
+ ```ruby
38
+ use_extension( Blacklight::Solr::Document::Marc) do |document|
39
+ document.key?( :marc_display )
40
+ end
41
+ ```
42
+
43
+ This means, the extension will be applied on the instance if the backing hash
44
+ has a field called `marc_display`.
45
+
46
+
47
+ ## Indexing
21
48
  The generator will create a model called MarcIndexer. This model can be customized by modifying
22
49
  the field configurations in its initializer as a Traject 2 indexer; new indexing behaviors can
23
50
  be added to it via mixins or inline methods. Two example mixins are provided:
@@ -35,12 +62,6 @@ MarcIndexer
35
62
  end
36
63
  end
37
64
  ```
38
- ## Features
39
- * Rake task `solr:marc:index` to import .mrc files using Traject and app/models/marc_indexer
40
- * Librarian view at `catalog/:id/librarian_view`
41
- * Export records to refworks and endnote
42
- * Blacklight::Solr::Document mixins for exporting and transforming MARC data from a stored Solr field
43
-
44
65
 
45
66
  ## Documentation, Information and Support
46
67
 
data/Rakefile CHANGED
@@ -2,8 +2,6 @@ require "bundler/gem_tasks"
2
2
  require 'rspec/core/rake_task'
3
3
  require 'engine_cart/rake_task'
4
4
 
5
- EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
6
-
7
5
  RSpec::Core::RakeTask.new(:spec)
8
6
 
9
7
  task :default => [:ci]
@@ -12,6 +12,9 @@ $marc_item_separator: 1px solid $text-muted !default;
12
12
  #marc_view
13
13
  {
14
14
  text-align:left;
15
+ /* https://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/ */
16
+ font-family: "Courier New", monospace, serif;
17
+ font-size: 1em;
15
18
 
16
19
  .field
17
20
  {
@@ -22,7 +25,7 @@ $marc_item_separator: 1px solid $text-muted !default;
22
25
  .ind1, .ind2
23
26
  {
24
27
  display:inline;
25
- padding:0 $padding-xs-horizontal;
28
+ padding: 0 ($spacer / 2);
26
29
  }
27
30
 
28
31
  .subfields
@@ -35,8 +38,3 @@ $marc_item_separator: 1px solid $text-muted !default;
35
38
  float:left;
36
39
  }
37
40
  }
38
-
39
- /* refworks uses a form; we need to give it some additional padding to make it look like a link */
40
- #refworks-form .btn {
41
- padding: $nav-link-padding;
42
- }
@@ -1,18 +1,18 @@
1
1
  module BlacklightMarcHelper
2
2
 
3
3
  # This method should move to BlacklightMarc in Blacklight 6.x
4
- def refworks_export_url params = {}
4
+ def refworks_export_url params = {}, *_
5
5
  "http://www.refworks.com/express/expressimport.asp?vendor=#{CGI.escape(params[:vendor] || application_name)}&filter=#{CGI.escape(params[:filter] || "MARC Format")}&encoding=65001" + (("&url=#{CGI.escape(params[:url])}" if params[:url]) || "")
6
6
  end
7
7
 
8
- def refworks_solr_document_path opts = {}
8
+ def refworks_solr_document_path opts = {}, *_
9
9
  if opts[:id]
10
10
  refworks_export_url(url: solr_document_url(opts[:id], format: :refworks_marc_txt))
11
11
  end
12
12
  end
13
13
 
14
14
  # For exporting a single endnote document. (endnote_catalog_path is defined by blacklight-marc and it is used for multiple document export)
15
- def single_endnote_catalog_path opts = {}
15
+ def single_endnote_catalog_path opts = {}, *_
16
16
  solr_document_path(opts.merge(format: 'endnote'))
17
17
  end
18
18
 
@@ -33,7 +33,8 @@ module BlacklightMarcHelper
33
33
  val = ''
34
34
  documents.each do |doc|
35
35
  if doc.exports_as? :endnote
36
- val += doc.export_as(:endnote) + "\n"
36
+ endnote = doc.export_as(:endnote)
37
+ val += "#{endnote}\n" if endnote
37
38
  end
38
39
  end
39
40
  val
@@ -6,7 +6,7 @@
6
6
  # then provides various transformations/exports of that Marc via the included
7
7
  # Blacklight::Solr::Document::MarcExport module.
8
8
  #
9
- # This extension would normally be registered using
9
+ # This extension would normally be registered using
10
10
  # Blacklight::Solr::Document#use_extension. eg:
11
11
  #
12
12
  # SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) { |document| my_logic_for_document_has_marc?( document ) }
@@ -20,15 +20,15 @@ require 'marc'
20
20
 
21
21
  module Blacklight::Solr::Document::Marc
22
22
 
23
- include Blacklight::Solr::Document::MarcExport # All our export_as stuff based on to_marc.
24
-
23
+ include Blacklight::Solr::Document::MarcExport # All our export_as stuff based on to_marc.
24
+
25
25
  class UnsupportedMarcFormatType < RuntimeError; end
26
-
26
+
27
27
  def self.extended(document)
28
- # Register our exportable formats, we inherit these from MarcExport
28
+ # Register our exportable formats, we inherit these from MarcExport
29
29
  Blacklight::Solr::Document::MarcExport.register_export_formats( document )
30
30
  end
31
-
31
+
32
32
  # ruby-marc object
33
33
  def to_marc
34
34
  @_ruby_marc_obj ||= load_marc
@@ -50,29 +50,30 @@ module Blacklight::Solr::Document::Marc
50
50
  return MARC::Record.new_from_hash( JSON.parse( fetch(_marc_source_field) ) )
51
51
  else
52
52
  raise UnsupportedMarcFormatType.new("Only marcxml, marc21, and json are supported, this documents format is #{_marc_format_type} and the current extension parameters are #{self.class.extension_parameters.inspect}")
53
- end
53
+ end
54
54
  rescue Exception => e
55
55
  raise e if e.is_a? UnsupportedMarcFormatType
56
56
 
57
57
  Rails.logger.error("Blacklight failed to parse MARC record. Exception was: #{e}")
58
+ nil
58
59
  end
59
-
60
+
60
61
  def marc_record_from_marcxml
61
62
  MARC::XMLReader.new(StringIO.new( fetch(_marc_source_field) )).to_a.first
62
63
  end
63
-
64
+
64
65
  def _marc_helper
65
66
  @_marc_helper ||= (
66
67
  Blacklight::Marc::Document.new fetch(_marc_source_field), _marc_format_type )
67
68
  end
68
69
 
69
- def _marc_source_field
70
+ def _marc_source_field
70
71
  self.class.extension_parameters[:marc_source_field]
71
72
  end
72
73
 
73
74
  def _marc_format_type
74
75
  #TODO: Raise if not present
75
- self.class.extension_parameters[:marc_format_type]
76
+ self.class.extension_parameters[:marc_format_type]
76
77
  end
77
-
78
+
78
79
  end
@@ -4,13 +4,13 @@
4
4
  # it for your own custom Blacklight document Marc extension too -- just
5
5
  # include this module in any document extension (or any other class)
6
6
  # that provides a #to_marc returning a ruby-marc object. This module will add
7
- # in export_as translation methods for a variety of formats.
7
+ # in export_as translation methods for a variety of formats.
8
8
  module Blacklight::Solr::Document::MarcExport
9
-
9
+
10
10
  def self.register_export_formats(document)
11
11
  document.will_export_as(:xml)
12
12
  document.will_export_as(:marc, "application/marc")
13
- # marcxml content type:
13
+ # marcxml content type:
14
14
  # http://tools.ietf.org/html/draft-denenberg-mods-etc-media-types-00
15
15
  document.will_export_as(:marcxml, "application/marcxml+xml")
16
16
  document.will_export_as(:openurl_ctx_kev, "application/x-openurl-ctx-kev")
@@ -27,20 +27,20 @@ module Blacklight::Solr::Document::MarcExport
27
27
  to_marc.to_xml.to_s
28
28
  end
29
29
  alias_method :export_as_xml, :export_as_marcxml
30
-
31
-
30
+
31
+
32
32
  # TODO This exporting as formatted citation thing should be re-thought
33
33
  # redesigned at some point to be more general purpose, but this
34
34
  # is in-line with what we had before, but at least now attached
35
- # to the document extension where it belongs.
35
+ # to the document extension where it belongs.
36
36
  def export_as_apa_citation_txt
37
37
  apa_citation( to_marc )
38
38
  end
39
-
39
+
40
40
  def export_as_mla_citation_txt
41
41
  mla_citation( to_marc )
42
42
  end
43
-
43
+
44
44
  def export_as_chicago_citation_txt
45
45
  chicago_citation( to_marc )
46
46
  end
@@ -52,8 +52,8 @@ module Blacklight::Solr::Document::MarcExport
52
52
  # more sensibly. The "format" argument was in the old marc.marc.to_zotero
53
53
  # call, but didn't neccesarily do what it thought it did anyway. Left in
54
54
  # for now for backwards compatibilty, but should be replaced by
55
- # just ruby OpenURL.
56
- def export_as_openurl_ctx_kev(format = nil)
55
+ # just ruby OpenURL.
56
+ def export_as_openurl_ctx_kev(format = nil)
57
57
  title = to_marc.find{|field| field.tag == '245'}
58
58
  author = to_marc.find{|field| field.tag == '100'}
59
59
  corp_author = to_marc.find{|field| field.tag == '110'}
@@ -100,11 +100,13 @@ module Blacklight::Solr::Document::MarcExport
100
100
 
101
101
  # This format used to be called 'refworks', which wasn't really
102
102
  # accurate, sounds more like 'refworks tagged format'. Which this
103
- # is not, it's instead some weird under-documented Refworks
103
+ # is not, it's instead some weird under-documented Refworks
104
104
  # proprietary marc-ish in text/plain format. See
105
- # http://robotlibrarian.billdueber.com/sending-marcish-data-to-refworks/
105
+ # http://robotlibrarian.billdueber.com/2009/05/sending-marcish-data-to-refworks/
106
106
  def export_as_refworks_marc_txt
107
- fields = to_marc.find_all { |f| ('000'..'999') === f.tag }
107
+ marc_obj = to_marc
108
+ return unless marc_obj
109
+ fields = marc_obj.find_all { |f| ('000'..'999') === f.tag }
108
110
  text = "LEADER #{to_marc.leader}"
109
111
  fields.each do |field|
110
112
  unless ["940","999"].include?(field.tag)
@@ -125,9 +127,9 @@ module Blacklight::Solr::Document::MarcExport
125
127
  # it seems to want C form normalization, although RefWorks support
126
128
  # couldn't tell me that. -jrochkind
127
129
  text = ActiveSupport::Multibyte::Unicode.normalize(text, :c)
128
-
130
+
129
131
  return text
130
- end
132
+ end
131
133
 
132
134
  # Endnote Import Format. See the EndNote User Guide at:
133
135
  # http://www.endnote.com/support/enx3man-terms-win.asp
@@ -138,7 +140,7 @@ module Blacklight::Solr::Document::MarcExport
138
140
  # endnote import format; the %0 is likely to be entirely illegal, the
139
141
  # rest of the data is barely correct but messy. TODO, a new version of this,
140
142
  # or better yet just an export_as_ris instead, which will be more general
141
- # purpose.
143
+ # purpose.
142
144
  def export_as_endnote()
143
145
  end_note_format = {
144
146
  "%A" => "100.a",
@@ -154,10 +156,12 @@ module Blacklight::Solr::Document::MarcExport
154
156
  "%7" => "250.a"
155
157
  }
156
158
  marc_obj = to_marc
159
+ return unless marc_obj
160
+
157
161
  # TODO. This should be rewritten to guess
158
162
  # from actual Marc instead, probably.
159
163
  format_str = 'Generic'
160
-
164
+
161
165
  text = ''
162
166
  text << "%0 #{ format_str }\n"
163
167
  # If there is some reliable way of getting the language of a record we can add it here
@@ -170,7 +174,7 @@ module Blacklight::Solr::Document::MarcExport
170
174
  else
171
175
  second_value = []
172
176
  end
173
-
177
+
174
178
  if marc_obj[first_value[0].to_s]
175
179
  marc_obj.find_all{|f| (first_value[0].to_s) === f.tag}.each do |field|
176
180
  if field[first_value[1]].to_s or field[second_value[1]].to_s
@@ -190,11 +194,11 @@ module Blacklight::Solr::Document::MarcExport
190
194
  end
191
195
 
192
196
  protected
193
-
197
+
194
198
  # Main method for defining chicago style citation. If we don't end up converting to using a citation formatting service
195
199
  # we should make this receive a semantic document and not MARC so we can use this with other formats.
196
200
  def chicago_citation(marc)
197
- authors = get_all_authors(marc)
201
+ authors = get_all_authors(marc)
198
202
  author_text = ""
199
203
  unless authors[:primary_authors].blank?
200
204
  if authors[:primary_authors].length > 10
@@ -226,7 +230,7 @@ module Blacklight::Solr::Document::MarcExport
226
230
  author_text << "and #{name_reverse(author)}."
227
231
  else
228
232
  author_text << "#{name_reverse(author)}, "
229
- end
233
+ end
230
234
  end
231
235
  else
232
236
  author_text << authors[:primary_authors].first
@@ -242,7 +246,7 @@ module Blacklight::Solr::Document::MarcExport
242
246
  authors[:compilers].each do |compiler|
243
247
  temp_authors << [compiler, "comp."]
244
248
  end
245
-
249
+
246
250
  unless temp_authors.blank?
247
251
  if temp_authors.length > 10
248
252
  temp_authors.each_with_index do |author,index|
@@ -281,18 +285,18 @@ module Blacklight::Solr::Document::MarcExport
281
285
  section_title << "."
282
286
  end
283
287
  end
284
-
288
+
285
289
  if !authors[:primary_authors].blank? and (!authors[:translators].blank? or !authors[:editors].blank? or !authors[:compilers].blank?)
286
290
  additional_title << "Translated by #{authors[:translators].collect{|name| name_reverse(name)}.join(" and ")}. " unless authors[:translators].blank?
287
291
  additional_title << "Edited by #{authors[:editors].collect{|name| name_reverse(name)}.join(" and ")}. " unless authors[:editors].blank?
288
292
  additional_title << "Compiled by #{authors[:compilers].collect{|name| name_reverse(name)}.join(" and ")}. " unless authors[:compilers].blank?
289
293
  end
290
-
294
+
291
295
  edition = ""
292
296
  edition << setup_edition(marc) unless setup_edition(marc).nil?
293
-
297
+
294
298
  pub_info = ""
295
- if marc["260"] and (marc["260"]["a"] or marc["260"]["b"])
299
+ if marc["260"] and (marc["260"]["a"] or marc["260"]["b"])
296
300
  pub_info << clean_end_punctuation(marc["260"]["a"]).strip if marc["260"]["a"]
297
301
  pub_info << ": #{clean_end_punctuation(marc["260"]["b"]).strip}" if marc["260"]["b"]
298
302
  pub_info << ", #{setup_pub_date(marc)}" if marc["260"]["c"]
@@ -301,7 +305,7 @@ module Blacklight::Solr::Document::MarcExport
301
305
  elsif marc["502"] and (marc["502"]["b"] or marc["502"]["c"] or marc["502"]["d"]) #sometimes the dissertation note is encoded in pieces in the $b $c and $d sub fields instead of lumped into the $a
302
306
  pub_info << "#{marc["502"]["b"]}, #{marc["502"]["c"]}, #{clean_end_punctuation(marc["502"]["d"])}"
303
307
  end
304
-
308
+
305
309
  citation = ""
306
310
  citation << "#{author_text} " unless author_text.blank?
307
311
  citation << "<i>#{title}.</i> " unless title.blank?
@@ -311,13 +315,13 @@ module Blacklight::Solr::Document::MarcExport
311
315
  citation << "#{pub_info}." unless pub_info.blank?
312
316
  citation
313
317
  end
314
-
315
-
316
-
318
+
319
+
320
+
317
321
  def mla_citation(record)
318
322
  text = ''
319
323
  authors_final = []
320
-
324
+
321
325
  #setup formatted author list
322
326
  authors = get_author_list(record)
323
327
 
@@ -351,10 +355,10 @@ module Blacklight::Solr::Document::MarcExport
351
355
  # Edition
352
356
  edition_data = setup_edition(record)
353
357
  text += edition_data + " " unless edition_data.nil?
354
-
358
+
355
359
  # Publication
356
360
  text += setup_pub_info(record) + ", " unless setup_pub_info(record).nil?
357
-
361
+
358
362
  # Get Pub Date
359
363
  text += setup_pub_date(record) unless setup_pub_date(record).nil?
360
364
  if text[-1,1] != "."
@@ -367,7 +371,7 @@ module Blacklight::Solr::Document::MarcExport
367
371
  text = ''
368
372
  authors_list = []
369
373
  authors_list_final = []
370
-
374
+
371
375
  #setup formatted author list
372
376
  authors = get_author_list(record)
373
377
  authors.each do |l|
@@ -392,15 +396,15 @@ module Blacklight::Solr::Document::MarcExport
392
396
  end
393
397
  # Get Pub Date
394
398
  text += "(" + setup_pub_date(record) + "). " unless setup_pub_date(record).nil?
395
-
399
+
396
400
  # setup title info
397
401
  title = setup_title_info(record)
398
402
  text += "<i>" + title + "</i> " unless title.nil?
399
-
403
+
400
404
  # Edition
401
405
  edition_data = setup_edition(record)
402
406
  text += edition_data + " " unless edition_data.nil?
403
-
407
+
404
408
  # Publisher info
405
409
  text += setup_pub_info(record) unless setup_pub_info(record).nil?
406
410
  unless text.blank?
@@ -451,7 +455,7 @@ module Blacklight::Solr::Document::MarcExport
451
455
  end
452
456
  new_text.join(" ")
453
457
  end
454
-
458
+
455
459
  # This will replace the mla_citation_title method with a better understanding of how MLA and Chicago citation titles are formatted.
456
460
  # This method will take in a string and capitalize all of the non-prepositions.
457
461
  def citation_title(title_text)
@@ -482,18 +486,18 @@ module Blacklight::Solr::Document::MarcExport
482
486
  end
483
487
  text += b_title_info unless b_title_info.nil?
484
488
  end
485
-
489
+
486
490
  return nil if text.strip.blank?
487
491
  clean_end_punctuation(text.strip) + "."
488
-
492
+
489
493
  end
490
-
494
+
491
495
  def clean_end_punctuation(text)
492
496
  if [".",",",":",";","/"].include? text[-1,1]
493
497
  return text[0,text.length-1]
494
498
  end
495
499
  text
496
- end
500
+ end
497
501
 
498
502
  def setup_edition(record)
499
503
  edition_field = record.find{|f| f.tag == '250'}
@@ -503,9 +507,9 @@ module Blacklight::Solr::Document::MarcExport
503
507
  return nil
504
508
  else
505
509
  return edition_data
506
- end
510
+ end
507
511
  end
508
-
512
+
509
513
  def get_author_list(record)
510
514
  author_list = []
511
515
  authors_primary = record.find{|f| f.tag == '100'}
@@ -517,11 +521,11 @@ module Blacklight::Solr::Document::MarcExport
517
521
  author_list.push(clean_end_punctuation(l.find{|s| s.code == 'a'}.value)) unless l.find{|s| s.code == 'a'}.value.nil?
518
522
  end
519
523
  end
520
-
524
+
521
525
  author_list.uniq!
522
526
  author_list
523
527
  end
524
-
528
+
525
529
  # This is a replacement method for the get_author_list method. This new method will break authors out into primary authors, translators, editors, and compilers
526
530
  def get_all_authors(record)
527
531
  translator_code = "trl"; editor_code = "edt"; compiler_code = "com"
@@ -547,7 +551,7 @@ module Blacklight::Solr::Document::MarcExport
547
551
  end
548
552
  {:primary_authors => primary_authors, :translators => translators, :editors => editors, :compilers => compilers}
549
553
  end
550
-
554
+
551
555
  def abbreviate_name(name)
552
556
  name_parts = name.split(", ")
553
557
  first_name_parts = name_parts.last.split(" ")
@@ -562,6 +566,5 @@ module Blacklight::Solr::Document::MarcExport
562
566
  return name unless name =~ /,/
563
567
  temp_name = name.split(", ")
564
568
  return temp_name.last + " " + temp_name.first
565
- end
566
-
567
- end
569
+ end
570
+ end