blacklight-marc 8.1.0 → 8.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +13 -9
- data/app/models/concerns/blacklight/marc/document_export.rb +33 -33
- data/blacklight-marc.gemspec +1 -1
- data/lib/blacklight/marc/version.rb +1 -1
- data/spec/lib/marc_export_spec.rb +56 -18
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 483538c623aaace602da20c35e7b3fc349ac18e06ffe4277ac9a14f14eff237e
|
4
|
+
data.tar.gz: cfbc11131199f2895db722e609a23dfa4cec8be8e27781f542076931988aaf5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6f9437f9c3a53fe810cf7f1fe1a831e7d6c1de22e9ab04927a0702163e4ef474c4868f322ce8bf2374a4a36fd4354a748a26788001e73b46bbe7dd8e85fe9d
|
7
|
+
data.tar.gz: 41943dec1aef4930cfb7ee783dadb6ba63d097882486547f292bb14c2e1f088685f17080a60483f2f08080878ebd61020d48a4ca739a1d0b247ee6f00ad270e6
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,21 +12,25 @@ jobs:
|
|
12
12
|
continue-on-error: ${{ matrix.experimental }}
|
13
13
|
strategy:
|
14
14
|
matrix:
|
15
|
-
ruby: [
|
16
|
-
rails_version: ['
|
17
|
-
blacklight_version: ['~>
|
15
|
+
ruby: ['3.2']
|
16
|
+
rails_version: ['7.1.3']
|
17
|
+
blacklight_version: ['~> 8.1']
|
18
18
|
experimental: [false]
|
19
19
|
include:
|
20
|
-
- ruby: '
|
21
|
-
rails_version: '7.
|
20
|
+
- ruby: '2.7'
|
21
|
+
rails_version: '6.1.7.6'
|
22
22
|
blacklight_version: '~> 7.0'
|
23
23
|
experimental: false
|
24
|
-
- ruby: '3.
|
25
|
-
rails_version: '7.0.
|
26
|
-
blacklight_version: '
|
24
|
+
- ruby: '3.0'
|
25
|
+
rails_version: '7.0.8'
|
26
|
+
blacklight_version: '~> 7.0'
|
27
27
|
experimental: false
|
28
28
|
- ruby: '3.1'
|
29
|
-
rails_version: '7.0.
|
29
|
+
rails_version: '7.0.8'
|
30
|
+
blacklight_version: '~> 8.1'
|
31
|
+
experimental: false
|
32
|
+
- ruby: '3.2'
|
33
|
+
rails_version: '7.1.3'
|
30
34
|
blacklight_version: 'github'
|
31
35
|
experimental: true
|
32
36
|
env:
|
@@ -62,40 +62,40 @@ module Blacklight::Marc::DocumentExport
|
|
62
62
|
edition = to_marc.find{|field| field.tag == '250'}
|
63
63
|
isbn = to_marc.find{|field| field.tag == '020'}
|
64
64
|
issn = to_marc.find{|field| field.tag == '022'}
|
65
|
-
|
66
|
-
|
65
|
+
format = format.first if format.is_a?(Array)
|
66
|
+
format = format.downcase.strip unless format.nil?
|
67
|
+
|
68
|
+
export_text = ""
|
69
|
+
if format == 'book'
|
70
|
+
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&rft.genre=book&"
|
71
|
+
export_text << "rft.btitle=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
72
|
+
export_text << "rft.title=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
73
|
+
export_text << "rft.au=#{(author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a'])}&"
|
74
|
+
export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&" unless corp_author.blank?
|
75
|
+
export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&"
|
76
|
+
export_text << "rft.place=#{(publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a'])}&"
|
77
|
+
export_text << "rft.pub=#{(publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b'])}&"
|
78
|
+
export_text << "rft.edition=#{(edition.nil? or edition['a'].nil?) ? "" : CGI::escape(edition['a'])}&"
|
79
|
+
export_text << "rft.isbn=#{(isbn.nil? or isbn['a'].nil?) ? "" : isbn['a']}"
|
80
|
+
elsif (format =~ /journal/i) # checking using include because institutions may use formats like Journal or Journal/Magazine
|
81
|
+
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&rft.genre=article&"
|
82
|
+
export_text << "rft.title=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
83
|
+
export_text << "rft.atitle=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
84
|
+
export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&" unless corp_author.blank?
|
85
|
+
export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&"
|
86
|
+
export_text << "rft.issn=#{(issn.nil? or issn['a'].nil?) ? "" : issn['a']}"
|
87
|
+
else
|
88
|
+
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&"
|
89
|
+
export_text << "rft.title=" + ((title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a']))
|
90
|
+
export_text << ((title.nil? or title['b'].nil?) ? "" : CGI.escape(" ") + CGI::escape(title['b']))
|
91
|
+
export_text << "&rft.creator=" + ((author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a']))
|
92
|
+
export_text << "&rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}" unless corp_author.blank?
|
93
|
+
export_text << "&rft.date=" + ((publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c']))
|
94
|
+
export_text << "&rft.place=" + ((publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a']))
|
95
|
+
export_text << "&rft.pub=" + ((publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b']))
|
96
|
+
export_text << "&rft.format=" + (format.nil? ? "" : CGI::escape(format))
|
67
97
|
end
|
68
|
-
|
69
|
-
if format == 'book'
|
70
|
-
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&rft.genre=book&"
|
71
|
-
export_text << "rft.btitle=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
72
|
-
export_text << "rft.title=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
73
|
-
export_text << "rft.au=#{(author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a'])}&"
|
74
|
-
export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&" unless corp_author.blank?
|
75
|
-
export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&"
|
76
|
-
export_text << "rft.place=#{(publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a'])}&"
|
77
|
-
export_text << "rft.pub=#{(publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b'])}&"
|
78
|
-
export_text << "rft.edition=#{(edition.nil? or edition['a'].nil?) ? "" : CGI::escape(edition['a'])}&"
|
79
|
-
export_text << "rft.isbn=#{(isbn.nil? or isbn['a'].nil?) ? "" : isbn['a']}"
|
80
|
-
elsif (format =~ /journal/i) # checking using include because institutions may use formats like Journal or Journal/Magazine
|
81
|
-
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&rft.genre=article&"
|
82
|
-
export_text << "rft.title=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
83
|
-
export_text << "rft.atitle=#{(title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a'])}+#{(title.nil? or title['b'].nil?) ? "" : CGI::escape(title['b'])}&"
|
84
|
-
export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&" unless corp_author.blank?
|
85
|
-
export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&"
|
86
|
-
export_text << "rft.issn=#{(issn.nil? or issn['a'].nil?) ? "" : issn['a']}"
|
87
|
-
else
|
88
|
-
export_text << "ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&"
|
89
|
-
export_text << "rft.title=" + ((title.nil? or title['a'].nil?) ? "" : CGI::escape(title['a']))
|
90
|
-
export_text << ((title.nil? or title['b'].nil?) ? "" : CGI.escape(" ") + CGI::escape(title['b']))
|
91
|
-
export_text << "&rft.creator=" + ((author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a']))
|
92
|
-
export_text << "&rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}" unless corp_author.blank?
|
93
|
-
export_text << "&rft.date=" + ((publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c']))
|
94
|
-
export_text << "&rft.place=" + ((publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a']))
|
95
|
-
export_text << "&rft.pub=" + ((publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b']))
|
96
|
-
export_text << "&rft.format=" + (format.nil? ? "" : CGI::escape(format))
|
97
|
-
end
|
98
|
-
export_text.html_safe unless export_text.blank?
|
98
|
+
export_text.html_safe unless export_text.blank?
|
99
99
|
end
|
100
100
|
|
101
101
|
|
data/blacklight-marc.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler"
|
29
29
|
spec.add_development_dependency "rake"
|
30
|
-
spec.add_development_dependency "rspec-rails", '~>
|
30
|
+
spec.add_development_dependency "rspec-rails", '~> 6.1'
|
31
31
|
spec.add_development_dependency "rspec-activemodel-mocks"
|
32
32
|
spec.add_development_dependency "solr_wrapper"
|
33
33
|
spec.add_development_dependency "capybara"
|
@@ -629,24 +629,62 @@ describe Blacklight::Solr::Document::MarcExport do
|
|
629
629
|
end
|
630
630
|
end
|
631
631
|
|
632
|
-
describe "export_as_openurl_ctx_kev" do
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
632
|
+
describe "#export_as_openurl_ctx_kev" do
|
633
|
+
subject(:record) { @typical_record.export_as_openurl_ctx_kev(format) }
|
634
|
+
|
635
|
+
context 'with a Book' do
|
636
|
+
let(:format) { 'Book' }
|
637
|
+
it "creates the appropriate context object" do
|
638
|
+
expect(record).to match(/.*mtx%3Abook.*rft.genre=book.*rft.btitle=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.place=Oxon%2C\+U.K.*rft.pub=CABI\+Pub.*rft.isbn=/)
|
639
|
+
expect(record).not_to match(/.*rft.genre=article.*rft.issn=.*/)
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
context 'with a Journal' do
|
644
|
+
let(:format) { 'Journal' }
|
645
|
+
it "creates the appropriate context object" do
|
646
|
+
expect(record).to match(/.*mtx%3Ajournal.*rft.genre=article.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.atitle=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.issn=/)
|
647
|
+
expect(record).not_to match(/.*rft.genre=book.*rft.isbn=.*/)
|
648
|
+
end
|
649
|
+
end
|
650
|
+
|
651
|
+
context 'with a Journal/Magazine' do
|
652
|
+
let(:format) { 'Journal/Magazine' }
|
653
|
+
it "creates the appropriate context object" do
|
654
|
+
expect(record).to match(/.*mtx%3Ajournal.*rft.genre=article.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.atitle=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.issn=/)
|
655
|
+
expect(record).not_to match(/.*rft.genre=book.*rft.isbn=.*/)
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
context 'with other formats' do
|
660
|
+
let(:format) { 'NotARealFormat' }
|
661
|
+
it "creates the appropriate context object" do
|
662
|
+
expect(record).to match(/.*mtx%3Adc.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.creator=.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.place=Oxon%2C\+U.K.*rft.pub=CABI\+Pub.*rft.format=notarealformat/)
|
663
|
+
expect(record).not_to match(/.*rft.isbn=.*/)
|
664
|
+
expect(record).not_to match(/.*rft.issn=.*/)
|
665
|
+
end
|
666
|
+
end
|
667
|
+
|
668
|
+
context 'with an array' do
|
669
|
+
let(:format) { ['Journal'] }
|
670
|
+
it "creates the appropriate context object" do
|
671
|
+
expect(record).to match(/.*mtx%3Ajournal.*rft.genre=article.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.atitle=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.issn=/)
|
672
|
+
expect(record).not_to match(/.*rft.genre=book.*rft.isbn=.*/)
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
676
|
+
context 'with a nil format' do
|
677
|
+
let(:format) { nil }
|
678
|
+
it "creates the appropriate context object" do
|
679
|
+
expect(record).to match(/.*mtx%3Adc.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.creator=.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.place=Oxon%2C\+U.K.*rft.pub=CABI\+Pub.*rft.format=/)
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
683
|
+
context 'with an empty array' do
|
684
|
+
let(:format) { [] }
|
685
|
+
it "creates the appropriate context object" do
|
686
|
+
expect(record).to match(/.*mtx%3Adc.*rft.title=Apples\+%3A\+botany%2C\+production%2C\+and\+uses.*rft.creator=.*rft.aucorp=Bobs\+Your\+Uncle.*rft.date=c2003.*rft.place=Oxon%2C\+U.K.*rft.pub=CABI\+Pub.*rft.format=/)
|
687
|
+
end
|
650
688
|
end
|
651
689
|
end
|
652
690
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-marc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.1.
|
4
|
+
version: 8.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -140,14 +140,14 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
143
|
+
version: '6.1'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
150
|
+
version: '6.1'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: rspec-activemodel-mocks
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
331
|
- !ruby/object:Gem::Version
|
332
332
|
version: '0'
|
333
333
|
requirements: []
|
334
|
-
rubygems_version: 3.
|
334
|
+
rubygems_version: 3.5.4
|
335
335
|
signing_key:
|
336
336
|
specification_version: 4
|
337
337
|
summary: MARC support for Blacklight
|