blacklight-marc 6.0.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -2
- data/.solr_wrapper.yaml +5 -0
- data/.travis.yml +9 -11
- data/Gemfile +30 -14
- data/README.md +29 -8
- data/Rakefile +8 -20
- data/app/assets/stylesheets/blacklight_marc.scss +4 -6
- data/app/helpers/blacklight_marc_helper.rb +5 -4
- data/app/models/concerns/blacklight/solr/document/marc.rb +13 -12
- data/app/models/concerns/blacklight/solr/document/marc_export.rb +53 -50
- data/app/views/bookmarks/_endnote.html.erb +1 -1
- data/app/views/bookmarks/_refworks.html.erb +1 -1
- data/app/views/catalog/_marc_view.html.erb +4 -4
- data/app/views/catalog/endnote.endnote.erb +1 -1
- data/app/views/catalog/librarian_view.html.erb +7 -4
- data/blacklight-marc.gemspec +12 -12
- data/config/routes.rb +1 -1
- data/lib/blacklight/marc/catalog.rb +9 -15
- data/lib/blacklight/marc/engine.rb +2 -0
- data/lib/blacklight/marc/indexer.rb +9 -39
- data/lib/blacklight/marc/indexer/formats.rb +13 -15
- data/lib/blacklight/marc/routes.rb +2 -39
- data/lib/blacklight/marc/routes/marc_viewable.rb +20 -0
- data/lib/blacklight/marc/version.rb +1 -1
- data/lib/generators/blacklight/marc/install_generator.rb +16 -9
- data/lib/generators/blacklight/marc/templates/app/models/marc_indexer.rb +59 -59
- data/lib/generators/blacklight/marc/templates/config/translation_maps/callnumber_map.properties +149 -11
- data/lib/railties/solr_marc.rake +33 -33
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +388 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +195 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/controllers/catalog_controller_spec.rb +11 -6
- data/spec/features/bookmarks_spec.rb +2 -1
- data/spec/features/search_formats_spec.rb +3 -3
- data/spec/integration/solr_document_spec.rb +19 -19
- data/spec/lib/blacklight_solr_document_marc_spec.rb +7 -7
- data/spec/lib/indexer/dewey_spec.rb +4 -4
- data/spec/lib/indexer/formats_spec.rb +9 -1
- data/spec/lib/marc_export_spec.rb +46 -46
- data/spec/lib/tasks/solr_marc_task_spec.rb +7 -7
- data/spec/lib/traject_indexer_spec.rb +6 -2
- data/spec/routing/routes_spec.rb +0 -6
- data/spec/spec_helper.rb +2 -2
- data/spec/test_app_templates/Gemfile.extra +2 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +15 -14
- data/spec/views/bookmarks/_endnote.html.erb_spec.rb +16 -6
- data/spec/views/bookmarks/_refworks.html.erb_spec.rb +17 -7
- data/spec/views/catalog/index.atom.builder_spec.rb +12 -17
- data/test_support/config/translation_maps/test_formats.properties +3 -1
- metadata +85 -60
- data/app/helpers/blacklight_bookmarks_helper.rb +0 -3
- data/config/jetty.yml +0 -4
@@ -2,22 +2,27 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe CatalogController do
|
5
|
+
before do
|
6
|
+
SolrDocument.use_extension( Blacklight::Solr::Document::Marc )
|
7
|
+
end
|
5
8
|
describe "endnote" do
|
6
|
-
before do
|
7
|
-
SolrDocument.use_extension( Blacklight::Solr::Document::Marc )
|
8
|
-
end
|
9
9
|
render_views
|
10
10
|
it "should render endnote" do
|
11
|
-
get :
|
11
|
+
get :show, params: { id: '86207417', format: 'endnote' }
|
12
12
|
expect(response.body).to eq "%0 Generic
|
13
13
|
%A Finkel, Chaim Jacob.
|
14
14
|
%C Yerushalayim :
|
15
15
|
%D c1984.
|
16
16
|
%I Devir,
|
17
17
|
%@ 9650101373
|
18
|
-
%T Shodede-yam Yehudiyim : sipurim mafliʼim ha-mevusasim ʻal ʻuvdot hisṭoriyot /\n
|
18
|
+
%T Shodede-yam Yehudiyim : sipurim mafliʼim ha-mevusasim ʻal ʻuvdot hisṭoriyot /\n"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
describe "#librarian_view" do
|
23
|
+
it "is successful" do
|
24
|
+
get :librarian_view, params: { id: '86207417' }
|
25
|
+
expect(response).to be_successful
|
26
|
+
end
|
27
|
+
end
|
23
28
|
end
|
@@ -12,6 +12,7 @@ describe "Bookmark tools" do
|
|
12
12
|
visit solr_document_path('2007020969')
|
13
13
|
click_button 'Bookmark'
|
14
14
|
visit "/bookmarks.refworks_marc_txt?q="
|
15
|
-
|
15
|
+
# modern capybara normalizes whitespace so don't check for strict nbsp
|
16
|
+
expect(page).to have_content "LEADER 01490cam a2200361 a 4500001"
|
16
17
|
end
|
17
18
|
end
|
@@ -10,7 +10,7 @@ describe "Search Formats" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return new-line separated RIS records" do
|
13
|
-
visit "/catalog.endnote?q="
|
13
|
+
visit "/catalog.endnote?q="
|
14
14
|
expect(page.status_code).to eq 200
|
15
15
|
rmt_regex = /^%0/
|
16
16
|
expect(page).to have_content "%A Bstan-ʼdzin-rgya-mtsho,"
|
@@ -20,12 +20,12 @@ describe "Search Formats" do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return new-line separated MARC records" do
|
23
|
-
visit "/catalog.refworks_marc_txt?q="
|
23
|
+
visit "/catalog.refworks_marc_txt?q="
|
24
24
|
expect(page.status_code).to eq 200
|
25
25
|
rmt_regex = /LEADER .+\n(\d\d\d .. .+\n)+/
|
26
26
|
expect(page).to have_content "LEADER 01221cam a22002534a 4500001"
|
27
27
|
expect(page).to have_content "LEADER 01127cam a22002895a 4500001"
|
28
28
|
expect(page.body).to match rmt_regex
|
29
|
-
expect(page.body.scan(rmt_regex).length).to eq 10
|
29
|
+
expect(page.body.scan(rmt_regex).length).to eq 10
|
30
30
|
end
|
31
31
|
end
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
|
5
5
|
# WARNING!!!
|
6
6
|
# If you set any values in Blacklight here, you must reset them to the original
|
7
|
-
# values in an after() block so other tests get expected results.
|
7
|
+
# values in an after() block so other tests get expected results.
|
8
8
|
# Blacklight is a Singleton for application configuration.
|
9
9
|
|
10
10
|
## TODO: ALL these specs probably really ought to be on the modules
|
@@ -24,45 +24,45 @@ def get_hash_with_bad_marcxml
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe SolrDocument do
|
27
|
-
|
27
|
+
# SolrDocument leaks to other classes, so subclass here to test extension behavior
|
28
|
+
let(:test_rig) { Class.new(SolrDocument) }
|
29
|
+
before do
|
30
|
+
test_rig.extension_parameters[:marc_source_field] = :marc_display
|
31
|
+
test_rig.extension_parameters[:marc_format_type] = :marcxml
|
32
|
+
|
33
|
+
test_rig.registered_extensions = nil
|
34
|
+
test_rig.use_extension( Blacklight::Solr::Document::Marc ) { |document| document.has_key?(:marc_display)}
|
35
|
+
end
|
36
|
+
|
28
37
|
before(:each) do
|
29
38
|
@hash_with_marcxml = get_hash_with_marcxml['response']['docs'][0]
|
30
|
-
SolrDocument.extension_parameters[:marc_source_field] = :marc_display
|
31
|
-
SolrDocument.extension_parameters[:marc_format_type] = :marcxml
|
32
|
-
|
33
|
-
# rsolr seems to reload SolrDocument from time to time, so we can't
|
34
|
-
# count on the initializer to register the extension, need to re-register
|
35
|
-
# it.
|
36
|
-
SolrDocument.registered_extensions = nil
|
37
|
-
SolrDocument.use_extension( Blacklight::Solr::Document::Marc ) { |document| document.has_key?(:marc_display)}
|
38
39
|
|
39
|
-
@solrdoc =
|
40
|
-
|
40
|
+
@solrdoc = test_rig.new(@hash_with_marcxml)
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "ruby marc creation" do
|
44
|
-
|
44
|
+
|
45
45
|
it "should have a valid to_marc" do
|
46
|
-
@solrdoc =
|
46
|
+
@solrdoc = test_rig.new(@hash_with_marcxml)
|
47
47
|
|
48
48
|
expect(@solrdoc).to respond_to(:to_marc)
|
49
|
-
expect(@solrdoc.to_marc).to be_kind_of(MARC::Record)
|
49
|
+
expect(@solrdoc.to_marc).to be_kind_of(MARC::Record)
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it "should not try to create marc for objects w/out stored marc (marcxml test only at this time)" do
|
53
53
|
@hash_without_marcxml = get_hash_without_marcxml['response']['docs'][0]
|
54
|
-
@solrdoc_without_marc =
|
54
|
+
@solrdoc_without_marc = test_rig.new(@hash_without_marcxml)
|
55
55
|
|
56
56
|
expect(@solrdoc_without_marc).not_to respond_to(:to_marc)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should fail gracefully when given bad marc xml" do
|
60
60
|
hash_with_bad_marcxml = get_hash_with_bad_marcxml['response']['docs'][0]
|
61
|
-
@solrdoc =
|
61
|
+
@solrdoc = test_rig.new(hash_with_bad_marcxml)
|
62
62
|
expect(Rails.logger).to receive(:error).with(/Blacklight failed to parse MARC record. Exception was: Missing end tag for 'blarg'/)
|
63
63
|
expect(@solrdoc).to respond_to(:to_marc)
|
64
64
|
expect(@solrdoc.to_marc).to be_nil
|
65
65
|
end
|
66
66
|
|
67
|
-
end
|
67
|
+
end
|
68
68
|
end
|
@@ -8,12 +8,12 @@ describe "Blacklight::Solr::Document::Marc" do
|
|
8
8
|
include Blacklight::Solr::Document
|
9
9
|
end
|
10
10
|
@mock_class.use_extension( Blacklight::Solr::Document::Marc )
|
11
|
-
@mock_class.extension_parameters[:marc_source_field] = :marc
|
11
|
+
@mock_class.extension_parameters[:marc_source_field] = :marc
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "marc binary mode" do
|
15
15
|
before(:each) do
|
16
|
-
@mock_class.extension_parameters[:marc_format_type] = :marc21
|
16
|
+
@mock_class.extension_parameters[:marc_format_type] = :marc21
|
17
17
|
end
|
18
18
|
it "should read and parse a marc binary file" do
|
19
19
|
document = @mock_class.new(:marc => sample_marc_binary )
|
@@ -43,7 +43,7 @@ describe "Blacklight::Solr::Document::Marc" do
|
|
43
43
|
|
44
44
|
it "should register all its export formats" do
|
45
45
|
document = @mock_class.new
|
46
|
-
expect(Set.new(document.export_formats.keys)).to be_superset(Set.new([:marc, :marcxml, :openurl_ctx_kev, :refworks_marc_txt, :endnote, :xml]))
|
46
|
+
expect(Set.new(document.export_formats.keys)).to be_superset(Set.new([:marc, :marcxml, :openurl_ctx_kev, :refworks_marc_txt, :endnote, :xml]))
|
47
47
|
end
|
48
48
|
|
49
49
|
|
@@ -54,26 +54,26 @@ describe "Blacklight::Solr::Document::Marc" do
|
|
54
54
|
<controlfield tag=\"001\">a4802615</controlfield>
|
55
55
|
<controlfield tag=\"003\">SIRSI</controlfield>
|
56
56
|
<controlfield tag=\"008\">020828s2003 enkaf b 001 0 eng </controlfield>
|
57
|
-
|
57
|
+
|
58
58
|
<datafield tag=\"245\" ind1=\"0\" ind2=\"0\">
|
59
59
|
<subfield code=\"a\">Apples :</subfield>
|
60
60
|
<subfield code=\"b\">botany, production, and uses /</subfield>
|
61
61
|
<subfield code=\"c\">edited by D.C. Ferree and I.J. Warrington.</subfield>
|
62
62
|
</datafield>
|
63
|
-
|
63
|
+
|
64
64
|
<datafield tag=\"260\" ind1=\" \" ind2=\" \">
|
65
65
|
<subfield code=\"a\">Oxon, U.K. ;</subfield>
|
66
66
|
<subfield code=\"a\">Cambridge, MA :</subfield>
|
67
67
|
<subfield code=\"b\">CABI Pub.,</subfield>
|
68
68
|
<subfield code=\"c\">c2003.</subfield>
|
69
69
|
</datafield>
|
70
|
-
|
70
|
+
|
71
71
|
<datafield tag=\"700\" ind1=\"1\" ind2=\" \">
|
72
72
|
<subfield code=\"a\">Ferree, David C.</subfield>
|
73
73
|
<subfield code=\"q\">(David Curtis),</subfield>
|
74
74
|
<subfield code=\"d\">1943-</subfield>
|
75
75
|
</datafield>
|
76
|
-
|
76
|
+
|
77
77
|
<datafield tag=\"700\" ind1=\"1\" ind2=\" \">
|
78
78
|
<subfield code=\"a\">Warrington, I. J.</subfield>
|
79
79
|
<subfield code=\"q\">(Ian J.)</subfield>
|
@@ -32,7 +32,7 @@ describe Blacklight::Marc::Indexer::Dewey do
|
|
32
32
|
it 'should map valid dewey' do
|
33
33
|
record = double('Record')
|
34
34
|
# just return bytes for control field, subfield array for data
|
35
|
-
expect(record).to receive(:fields).with(['082','880']).exactly(2).times.and_return([dewey])
|
35
|
+
expect(record).to receive(:fields).with(['082','880']).exactly(2).times.and_return([dewey])
|
36
36
|
val = []
|
37
37
|
subject.dewey_facets(base: :hundreds, translation_map: 'test_dewey').call(record,val,subject)
|
38
38
|
expect(val).to eql(['300s - Social Sciences'])
|
@@ -43,7 +43,7 @@ describe Blacklight::Marc::Indexer::Dewey do
|
|
43
43
|
it 'should ignore invalid dewey' do
|
44
44
|
record = double('Record')
|
45
45
|
# just return bytes for control field, subfield array for data
|
46
|
-
expect(record).to receive(:fields).with(['082','880']).exactly(2).times.and_return([huey])
|
46
|
+
expect(record).to receive(:fields).with(['082','880']).exactly(2).times.and_return([huey])
|
47
47
|
val = []
|
48
48
|
subject.dewey_facets(base: :hundreds, translation_map: 'test_dewey').call(record,val,subject)
|
49
49
|
expect(val).to eql([])
|
@@ -59,7 +59,7 @@ describe Blacklight::Marc::Indexer::Dewey do
|
|
59
59
|
it 'should generate formatted, unmapped text' do
|
60
60
|
record = double('Record')
|
61
61
|
# just return bytes for control field, subfield array for data
|
62
|
-
expect(record).to receive(:fields).with(['082','880']).and_return([dewey])
|
62
|
+
expect(record).to receive(:fields).with(['082','880']).and_return([dewey])
|
63
63
|
val = []
|
64
64
|
subject.dewey_text.call(record,val,subject)
|
65
65
|
expect(val).to eql(['343 13'])
|
@@ -67,7 +67,7 @@ describe Blacklight::Marc::Indexer::Dewey do
|
|
67
67
|
it 'should ignore invalid dewey' do
|
68
68
|
record = double('Record')
|
69
69
|
# just return bytes for control field, subfield array for data
|
70
|
-
expect(record).to receive(:fields).with(['082','880']).times.and_return([huey])
|
70
|
+
expect(record).to receive(:fields).with(['082','880']).times.and_return([huey])
|
71
71
|
val = []
|
72
72
|
subject.dewey_text.call(record,val,subject)
|
73
73
|
expect(val).to eql([])
|
@@ -28,7 +28,7 @@ describe Blacklight::Marc::Indexer::Formats do
|
|
28
28
|
it 'should map for 245h fields' do
|
29
29
|
record = double('Record')
|
30
30
|
# just return bytes for control field, subfield array for data
|
31
|
-
expect(record).to receive(:fields).with(['245','880']).and_return([electronic])
|
31
|
+
expect(record).to receive(:fields).with(['245','880']).and_return([electronic])
|
32
32
|
val = []
|
33
33
|
subject.get_format.call(record,val,subject)
|
34
34
|
expect(val).to eql(['Electronic'])
|
@@ -41,6 +41,14 @@ describe Blacklight::Marc::Indexer::Formats do
|
|
41
41
|
subject.get_format.call(record,val,subject)
|
42
42
|
expect(val).to eql(['TapeCartridge'])
|
43
43
|
end
|
44
|
+
it 'should map for 007 field with AD value' do
|
45
|
+
record = double('Record')
|
46
|
+
allow(record).to receive(:fields).with(["245", "880"]).and_return([])
|
47
|
+
expect(record).to receive(:fields).with(["007", "880"]).and_return([MARC::ControlField.new('007','AD')])
|
48
|
+
val = []
|
49
|
+
subject.get_format.call(record,val,subject)
|
50
|
+
expect(val).to eql(['Atlas'])
|
51
|
+
end
|
44
52
|
it 'should map for leader' do
|
45
53
|
record = double('Record')
|
46
54
|
allow(record).to receive(:fields).with(["245", "880"]).and_return([])
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
def marc_from_xml(string)
|
4
|
+
def marc_from_xml(string)
|
5
5
|
reader = MARC::XMLReader.new(StringIO.new(string))
|
6
6
|
reader.each {|rec| return rec }
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
|
10
10
|
def standard_citation
|
11
11
|
"<record>
|
@@ -110,7 +110,7 @@ def utf8_decomposed_record_xml
|
|
110
110
|
"<record>
|
111
111
|
<leader>01341nam 2200301 a 450 </leader>
|
112
112
|
<controlfield tag=\"005\">19971120234400.0</controlfield>
|
113
|
-
<controlfield tag=\"008\">890316s1988 caua b 101 0 eng </controlfield>
|
113
|
+
<controlfield tag=\"008\">890316s1988 caua b 101 0 eng </controlfield>
|
114
114
|
<datafield tag=\"245\" ind1=\"0\" ind2=\"0\">
|
115
115
|
<subfield code=\"a\">Sharīʻat and ambiguity in South Asian Islam /</subfield>
|
116
116
|
<subfield code=\"c\">edited by Katherine P. Ewing.</subfield>
|
@@ -188,7 +188,7 @@ def year_range_xml
|
|
188
188
|
<subfield code=\"b\">Batsford,</subfield>
|
189
189
|
<subfield code=\"c\">1988-2000</subfield>
|
190
190
|
</datafield>
|
191
|
-
|
191
|
+
|
192
192
|
</record>"
|
193
193
|
end
|
194
194
|
|
@@ -213,7 +213,7 @@ def no_date_xml
|
|
213
213
|
<subfield code=\"b\">Batsford,</subfield>
|
214
214
|
<subfield code=\"c\">n.d.</subfield>
|
215
215
|
</datafield>
|
216
|
-
|
216
|
+
|
217
217
|
</record>"
|
218
218
|
end
|
219
219
|
|
@@ -240,7 +240,7 @@ def section_title_xml
|
|
240
240
|
<subfield code=\"b\">Batsford,</subfield>
|
241
241
|
<subfield code=\"c\">2001</subfield>
|
242
242
|
</datafield>
|
243
|
-
|
243
|
+
|
244
244
|
</record>"
|
245
245
|
end
|
246
246
|
|
@@ -256,7 +256,7 @@ def dissertation_note_xml
|
|
256
256
|
<datafield tag=\"260\" ind1=\" \" ind2=\" \">
|
257
257
|
<subfield code=\"c\">2009</subfield>
|
258
258
|
</datafield>
|
259
|
-
|
259
|
+
|
260
260
|
<datafield tag=\"502\" ind1=\"0\" ind2=\"0\">
|
261
261
|
<subfield code=\"a\">Phd Thesis -- Goodenough College, 2009</subfield>
|
262
262
|
</datafield>
|
@@ -267,11 +267,11 @@ def special_contributor_with_author_xml
|
|
267
267
|
"<record>
|
268
268
|
<leader>00903nam a2200253 4500</leader>
|
269
269
|
<controlfield tag=\"008\">730111s1971 ohu b 000 0 eng </controlfield>
|
270
|
-
|
270
|
+
|
271
271
|
<datafield tag=\"100\" ind1=\"0\" ind2=\"0\">
|
272
272
|
<subfield code=\"a\">Doe, John</subfield>
|
273
273
|
</datafield>
|
274
|
-
|
274
|
+
|
275
275
|
<datafield tag=\"245\" ind1=\"0\" ind2=\"0\">
|
276
276
|
<subfield code=\"a\">Title of item.</subfield>
|
277
277
|
</datafield>
|
@@ -281,22 +281,22 @@ def special_contributor_with_author_xml
|
|
281
281
|
<subfield code=\"b\">Place</subfield>
|
282
282
|
<subfield code=\"c\">2009</subfield>
|
283
283
|
</datafield>
|
284
|
-
|
284
|
+
|
285
285
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
286
286
|
<subfield code=\"a\">Schmoe, Joe</subfield>
|
287
287
|
<subfield code=\"e\">trl.</subfield>
|
288
288
|
</datafield>
|
289
|
-
|
289
|
+
|
290
290
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
291
291
|
<subfield code=\"a\">Schmoe, Bill</subfield>
|
292
292
|
<subfield code=\"4\">edt</subfield>
|
293
293
|
</datafield>
|
294
|
-
|
294
|
+
|
295
295
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
296
296
|
<subfield code=\"a\">Schmoe, Susie</subfield>
|
297
297
|
<subfield code=\"e\">com.</subfield>
|
298
298
|
</datafield>
|
299
|
-
|
299
|
+
|
300
300
|
</record>"
|
301
301
|
end
|
302
302
|
|
@@ -304,11 +304,11 @@ def three_authors_xml
|
|
304
304
|
"<record>
|
305
305
|
<leader>00903nam a2200253 4500</leader>
|
306
306
|
<controlfield tag=\"008\">730111s1971 ohu b 000 0 eng </controlfield>
|
307
|
-
|
307
|
+
|
308
308
|
<datafield tag=\"100\" ind1=\"0\" ind2=\"0\">
|
309
309
|
<subfield code=\"a\">Doe, John</subfield>
|
310
310
|
</datafield>
|
311
|
-
|
311
|
+
|
312
312
|
<datafield tag=\"245\" ind1=\"0\" ind2=\"0\">
|
313
313
|
<subfield code=\"a\">Title of item.</subfield>
|
314
314
|
</datafield>
|
@@ -318,15 +318,15 @@ def three_authors_xml
|
|
318
318
|
<subfield code=\"b\">Place</subfield>
|
319
319
|
<subfield code=\"c\">2009</subfield>
|
320
320
|
</datafield>
|
321
|
-
|
321
|
+
|
322
322
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
323
323
|
<subfield code=\"a\">Schmoe, Joe</subfield>
|
324
324
|
</datafield>
|
325
|
-
|
325
|
+
|
326
326
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
327
327
|
<subfield code=\"a\">Schmoe, Bill</subfield>
|
328
328
|
</datafield>
|
329
|
-
|
329
|
+
|
330
330
|
</record>"
|
331
331
|
end
|
332
332
|
|
@@ -334,7 +334,7 @@ def special_contributor_no_author_xml
|
|
334
334
|
"<record>
|
335
335
|
<leader>00903nam a2200253 4500</leader>
|
336
336
|
<controlfield tag=\"008\">730111s1971 ohu b 000 0 eng </controlfield>
|
337
|
-
|
337
|
+
|
338
338
|
<datafield tag=\"245\" ind1=\"0\" ind2=\"0\">
|
339
339
|
<subfield code=\"a\">Title of item.</subfield>
|
340
340
|
</datafield>
|
@@ -344,22 +344,22 @@ def special_contributor_no_author_xml
|
|
344
344
|
<subfield code=\"b\">Place</subfield>
|
345
345
|
<subfield code=\"c\">2009</subfield>
|
346
346
|
</datafield>
|
347
|
-
|
347
|
+
|
348
348
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
349
349
|
<subfield code=\"a\">Schmoe, Joe</subfield>
|
350
350
|
<subfield code=\"e\">trl.</subfield>
|
351
351
|
</datafield>
|
352
|
-
|
352
|
+
|
353
353
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
354
354
|
<subfield code=\"a\">Schmoe, Bill</subfield>
|
355
355
|
<subfield code=\"4\">edt</subfield>
|
356
356
|
</datafield>
|
357
|
-
|
357
|
+
|
358
358
|
<datafield tag=\"700\" ind1=\" \" ind2=\" \">
|
359
359
|
<subfield code=\"a\">Schmoe, Susie</subfield>
|
360
360
|
<subfield code=\"e\">com.</subfield>
|
361
361
|
</datafield>
|
362
|
-
|
362
|
+
|
363
363
|
</record>"
|
364
364
|
end
|
365
365
|
|
@@ -422,23 +422,23 @@ def record3_xml
|
|
422
422
|
<subfield code=\"m\">horn, piano,</subfield>
|
423
423
|
<subfield code=\"r\">F major.</subfield>
|
424
424
|
</datafield>
|
425
|
-
|
425
|
+
|
426
426
|
<datafield tag=\"700\" ind1=\"1\" ind2=\"2\">
|
427
427
|
<subfield code=\"a\">Doe, John</subfield>
|
428
428
|
</datafield>
|
429
|
-
|
429
|
+
|
430
430
|
<datafield tag=\"700\" ind1=\"1\" ind2=\"2\">
|
431
431
|
<subfield code=\"a\">Doe, Jane</subfield>
|
432
432
|
</datafield>
|
433
|
-
|
433
|
+
|
434
434
|
<datafield tag=\"700\" ind1=\"1\" ind2=\"2\">
|
435
435
|
<subfield code=\"a\">Smith, John</subfield>
|
436
436
|
</datafield>
|
437
|
-
|
437
|
+
|
438
438
|
<datafield tag=\"700\" ind1=\"1\" ind2=\"2\">
|
439
439
|
<subfield code=\"a\">Smith, Jane</subfield>
|
440
440
|
</datafield>
|
441
|
-
|
441
|
+
|
442
442
|
<datafield tag=\"700\" ind1=\"1\" ind2=\"2\">
|
443
443
|
<subfield code=\"a\">Smith, James</subfield>
|
444
444
|
</datafield>
|
@@ -453,7 +453,7 @@ def no_good_data_xml
|
|
453
453
|
<controlfield tag=\"003\">SIRSI</controlfield>
|
454
454
|
<controlfield tag=\"007\">sd fungnnmmned</controlfield>
|
455
455
|
<controlfield tag=\"008\">020117p20011990xxuzz h d</controlfield>
|
456
|
-
|
456
|
+
|
457
457
|
<datafield tag=\"024\" ind1=\"1\" ind2=\" \">
|
458
458
|
<subfield code=\"a\">713746703721</subfield>
|
459
459
|
</datafield>
|
@@ -514,7 +514,7 @@ def bad_author_xml
|
|
514
514
|
end
|
515
515
|
|
516
516
|
describe Blacklight::Solr::Document::MarcExport do
|
517
|
-
|
517
|
+
|
518
518
|
before(:all) do
|
519
519
|
dclass = Class.new do
|
520
520
|
include Blacklight::Solr::Document::MarcExport
|
@@ -541,7 +541,7 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
541
541
|
@record_utf8_decomposed = dclass.new( utf8_decomposed_record_xml )
|
542
542
|
|
543
543
|
end
|
544
|
-
|
544
|
+
|
545
545
|
describe "export_as_chicago_citation_txt" do
|
546
546
|
it "should handle a typical record correclty" do
|
547
547
|
expect(@typical_record.export_as_chicago_citation_txt).to eq("Ferree, David C., and I. J Warrington. <i>Apples: Botany, Production, and Uses.</i> Oxon, U.K.: CABI Pub., 2003.")
|
@@ -583,20 +583,20 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
583
583
|
expect(@record_without_citable_data.export_as_chicago_citation_txt).to eq("")
|
584
584
|
end
|
585
585
|
end
|
586
|
-
|
586
|
+
|
587
587
|
describe "export_as_apa_citation_txt" do
|
588
588
|
it "should format a standard citation correctly" do
|
589
589
|
expect(@typical_record.export_as_apa_citation_txt).to eq("Ferree, D. C, & Warrington, I. J. (2003). <i>Apples : botany, production, and uses.</i> Oxon, U.K.: CABI Pub.")
|
590
590
|
end
|
591
|
-
|
591
|
+
|
592
592
|
it "should format a citation without a 245b field correctly" do
|
593
593
|
expect(@record_without_245b.export_as_apa_citation_txt).to eq("Janetzky, K., & Brüchle, B. (1988). <i>The horn.</i> London: Batsford.")
|
594
594
|
end
|
595
|
-
|
595
|
+
|
596
596
|
it "should format a citation without any authors correctly" do
|
597
597
|
expect(@record_without_authors.export_as_apa_citation_txt).to eq("(1971). <i>Final report to the Honorable John J. Gilligan, Governor.</i> [Columbus: Printed by the State of Ohio, Dept. of Urban Affairs.")
|
598
598
|
end
|
599
|
-
|
599
|
+
|
600
600
|
it "should not fail if there is no citation data" do
|
601
601
|
expect(@record_without_citable_data.export_as_apa_citation_txt).to eq("")
|
602
602
|
end
|
@@ -604,31 +604,31 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
604
604
|
it "should not bomb with a null pointer if there if author data is empty" do
|
605
605
|
expect(@record_with_bad_author.export_as_apa_citation_txt).to eq("Brüchle, B. (1988). <i>The horn.</i> London: Batsford.")
|
606
606
|
end
|
607
|
-
|
607
|
+
|
608
608
|
end
|
609
|
-
|
609
|
+
|
610
610
|
describe "export_as_mla_citation_txt" do
|
611
611
|
it "should format a standard citation correctly" do
|
612
612
|
expect(@typical_record.export_as_mla_citation_txt).to eq("Ferree, David C, and I. J Warrington. <i>Apples : Botany, Production, and Uses.</i> Oxon, U.K.: CABI Pub., 2003.")
|
613
613
|
end
|
614
|
-
|
614
|
+
|
615
615
|
it "should format a citation without a 245b field correctly" do
|
616
616
|
expect(@record_without_245b.export_as_mla_citation_txt).to eq("Janetzky, Kurt, and Bernhard Brüchle. <i>The Horn.</i> London: Batsford, 1988.")
|
617
617
|
end
|
618
|
-
|
618
|
+
|
619
619
|
it "should format a citation without any authors correctly" do
|
620
620
|
expect(@record_without_authors.export_as_mla_citation_txt).to eq("<i>Final Report to the Honorable John J. Gilligan, Governor.</i> [Columbus: Printed by the State of Ohio, Dept. of Urban Affairs, 1971.")
|
621
621
|
end
|
622
|
-
|
622
|
+
|
623
623
|
it "should format a citation with 4+ authors correctly" do
|
624
624
|
expect(@record_with_10plus_authors.export_as_mla_citation_txt).to eq("Greer, Lowell, et al. <i>Music for Horn.</i> [United States]: Harmonia Mundi USA, 2001.")
|
625
625
|
end
|
626
|
-
|
626
|
+
|
627
627
|
it "should not fail if there is no citation data" do
|
628
|
-
expect(@record_without_citable_data.export_as_mla_citation_txt).to eq("")
|
628
|
+
expect(@record_without_citable_data.export_as_mla_citation_txt).to eq("")
|
629
629
|
end
|
630
630
|
end
|
631
|
-
|
631
|
+
|
632
632
|
describe "export_as_openurl_ctx_kev" do
|
633
633
|
it "should create the appropriate context object for books" do
|
634
634
|
record = @typical_record.export_as_openurl_ctx_kev('Book')
|
@@ -673,7 +673,7 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
673
673
|
expect(@music_record.export_as_refworks_marc_txt).to eq("LEADER 01828cjm a2200409 a 4500001 a4768316\n003 SIRSI\n007 sd fungnnmmned\n008 020117p20011990xxuzz h d\n245 00 Music for horn |h[sound recording] / |cBrahms, Beethoven, von Krufft.\n260 [United States] : |bHarmonia Mundi USA, |cp2001.\n700 1 Greer, Lowell.\n700 1 Lubin, Steven.\n700 1 Chase, Stephanie, |d1957-\n700 12 Brahms, Johannes, |d1833-1897. |tTrios, |mpiano, violin, horn, |nop. 40, |rE? major.\n700 12 Beethoven, Ludwig van, |d1770-1827. |tSonatas, |mhorn, piano, |nop. 17, |rF major.\n700 12 Krufft, Nikolaus von, |d1779-1818. |tSonata, |mhorn, piano, |rF major.\n")
|
674
674
|
end
|
675
675
|
describe "for UTF-8 record" do
|
676
|
-
it "should export in Unicode normalized C form" do
|
676
|
+
it "should export in Unicode normalized C form" do
|
677
677
|
@utf8_exported = @record_utf8_decomposed.export_as_refworks_marc_txt
|
678
678
|
|
679
679
|
if defined? Unicode
|
@@ -702,12 +702,12 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
702
702
|
expect(endnote_entries["T"]).to eq(Set.new(["Music for horn "]))
|
703
703
|
|
704
704
|
#nothing extra
|
705
|
-
expect(Set.new(endnote_entries.keys)).to eq(Set.new(["0", "C", "D", "E", "I", "T"]))
|
705
|
+
expect(Set.new(endnote_entries.keys)).to eq(Set.new(["0", "C", "D", "E", "I", "T"]))
|
706
706
|
end
|
707
707
|
end
|
708
708
|
|
709
709
|
describe "Citation title transformation" do
|
710
|
-
before(:each) do
|
710
|
+
before(:each) do
|
711
711
|
class CitationTitleTest
|
712
712
|
include Blacklight::Solr::Document::MarcExport
|
713
713
|
def transform_title(text)
|