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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23e9d46508c9e92c90ad0f589728440809b003db1ada7744b35961d393a7b17d
4
- data.tar.gz: a7760905d39e8540bf22a6adb5ce6883de27c02796569f2469b1c3008d52e89a
3
+ metadata.gz: 483538c623aaace602da20c35e7b3fc349ac18e06ffe4277ac9a14f14eff237e
4
+ data.tar.gz: cfbc11131199f2895db722e609a23dfa4cec8be8e27781f542076931988aaf5c
5
5
  SHA512:
6
- metadata.gz: c80948cb35c420f12a658f36084856113d5e240843fc78534b45f678985000b19b3d16830d2660edbfebd9a7fdb6ea9cc31089fe5d2885c7d47628b5dea7ffab
7
- data.tar.gz: f5909facef040f97f73d2071876e2c93a1cdb2cdbae2da9985b4e074780eb0fda021fdc902e7fcb8617387861c37d59d8340de5fc0fc562bfdf9715ce0b49260
6
+ metadata.gz: bc6f9437f9c3a53fe810cf7f1fe1a831e7d6c1de22e9ab04927a0702163e4ef474c4868f322ce8bf2374a4a36fd4354a748a26788001e73b46bbe7dd8e85fe9d
7
+ data.tar.gz: 41943dec1aef4930cfb7ee783dadb6ba63d097882486547f292bb14c2e1f088685f17080a60483f2f08080878ebd61020d48a4ca739a1d0b247ee6f00ad270e6
@@ -12,21 +12,25 @@ jobs:
12
12
  continue-on-error: ${{ matrix.experimental }}
13
13
  strategy:
14
14
  matrix:
15
- ruby: [2.7, '3.0']
16
- rails_version: ['6.1.7', '7.0.4']
17
- blacklight_version: ['~> 7.0']
15
+ ruby: ['3.2']
16
+ rails_version: ['7.1.3']
17
+ blacklight_version: ['~> 8.1']
18
18
  experimental: [false]
19
19
  include:
20
- - ruby: '3.1'
21
- rails_version: '7.0.4'
20
+ - ruby: '2.7'
21
+ rails_version: '6.1.7.6'
22
22
  blacklight_version: '~> 7.0'
23
23
  experimental: false
24
- - ruby: '3.1'
25
- rails_version: '7.0.4'
26
- blacklight_version: '8.0.0.beta4'
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.4'
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
- unless format.nil?
66
- format.is_a?(Array) ? format = format[0].downcase.strip : format = format.downcase.strip
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&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;rft.genre=book&amp;"
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'])}&amp;"
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'])}&amp;"
73
+ export_text << "rft.au=#{(author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a'])}&amp;"
74
+ export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&amp;" unless corp_author.blank?
75
+ export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&amp;"
76
+ export_text << "rft.place=#{(publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a'])}&amp;"
77
+ export_text << "rft.pub=#{(publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b'])}&amp;"
78
+ export_text << "rft.edition=#{(edition.nil? or edition['a'].nil?) ? "" : CGI::escape(edition['a'])}&amp;"
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&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;rft.genre=article&amp;"
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'])}&amp;"
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'])}&amp;"
84
+ export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&amp;" unless corp_author.blank?
85
+ export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&amp;"
86
+ export_text << "rft.issn=#{(issn.nil? or issn['a'].nil?) ? "" : issn['a']}"
87
+ else
88
+ export_text << "ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;"
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 << "&amp;rft.creator=" + ((author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a']))
92
+ export_text << "&amp;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 << "&amp;rft.date=" + ((publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c']))
94
+ export_text << "&amp;rft.place=" + ((publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a']))
95
+ export_text << "&amp;rft.pub=" + ((publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b']))
96
+ export_text << "&amp;rft.format=" + (format.nil? ? "" : CGI::escape(format))
67
97
  end
68
- export_text = ""
69
- if format == 'book'
70
- export_text << "ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;rft.genre=book&amp;"
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'])}&amp;"
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'])}&amp;"
73
- export_text << "rft.au=#{(author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a'])}&amp;"
74
- export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&amp;" unless corp_author.blank?
75
- export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&amp;"
76
- export_text << "rft.place=#{(publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a'])}&amp;"
77
- export_text << "rft.pub=#{(publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b'])}&amp;"
78
- export_text << "rft.edition=#{(edition.nil? or edition['a'].nil?) ? "" : CGI::escape(edition['a'])}&amp;"
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&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;rft.genre=article&amp;"
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'])}&amp;"
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'])}&amp;"
84
- export_text << "rft.aucorp=#{CGI::escape(corp_author['a']) if corp_author['a']}+#{CGI::escape(corp_author['b']) if corp_author['b']}&amp;" unless corp_author.blank?
85
- export_text << "rft.date=#{(publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c'])}&amp;"
86
- export_text << "rft.issn=#{(issn.nil? or issn['a'].nil?) ? "" : issn['a']}"
87
- else
88
- export_text << "ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Fblacklight.rubyforge.org%3Agenerator&amp;"
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 << "&amp;rft.creator=" + ((author.nil? or author['a'].nil?) ? "" : CGI::escape(author['a']))
92
- export_text << "&amp;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 << "&amp;rft.date=" + ((publisher_info.nil? or publisher_info['c'].nil?) ? "" : CGI::escape(publisher_info['c']))
94
- export_text << "&amp;rft.place=" + ((publisher_info.nil? or publisher_info['a'].nil?) ? "" : CGI::escape(publisher_info['a']))
95
- export_text << "&amp;rft.pub=" + ((publisher_info.nil? or publisher_info['b'].nil?) ? "" : CGI::escape(publisher_info['b']))
96
- export_text << "&amp;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
 
@@ -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", '~> 4.0'
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"
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Marc
3
- VERSION = '8.1.0'
3
+ VERSION = '8.1.1'
4
4
  end
5
5
  end
@@ -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
- it "should create the appropriate context object for books" do
634
- record = @typical_record.export_as_openurl_ctx_kev('Book')
635
- 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=/) and
636
- expect(record).not_to match(/.*rft.genre=article.*rft.issn=.*/)
637
- end
638
- it "should create the appropriate context object for journals" do
639
- record = @typical_record.export_as_openurl_ctx_kev('Journal')
640
- record_journal_other = @typical_record.export_as_openurl_ctx_kev('Journal/Magazine')
641
- 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=/) and
642
- expect(record_journal_other).to eq(record) and
643
- expect(record).not_to match(/.*rft.genre=book.*rft.isbn=.*/)
644
- end
645
- it "should create the appropriate context object for other content" do
646
- record = @typical_record.export_as_openurl_ctx_kev('NotARealFormat')
647
- 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/) and
648
- expect(record).not_to match(/.*rft.isbn=.*/) and
649
- expect(record).not_to match(/.*rft.issn=.*/)
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.0
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: 2023-06-07 00:00:00.000000000 Z
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: '4.0'
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: '4.0'
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.3.3
334
+ rubygems_version: 3.5.4
335
335
  signing_key:
336
336
  specification_version: 4
337
337
  summary: MARC support for Blacklight