pennmarc 1.2.7 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pennmarc/helpers/relation.rb +0 -10
- data/lib/pennmarc/helpers/title.rb +5 -5
- data/lib/pennmarc/mappings/locations.yml +4 -0
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/relation_spec.rb +0 -10
- data/spec/lib/pennmarc/helpers/title_spec.rb +26 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d760f01c8e5f5d4f5a4c284f8e758b44ecb9f0f8243c611ba758b6c4c714d375
|
4
|
+
data.tar.gz: f1059dad28e535ded5669c5c20a34a945fa15c3ee6ad769825bb7b8c5913e4f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 151cc1278e5768c883c932d86278d8f45f70aade214179d073e48b5c504600d4c8b15cbd24afa303853f1b0346752c808cdf96c7e57cbb93d7120ffbf092a298
|
7
|
+
data.tar.gz: 396128b00dab208a1954cab9aa34291fd46b020e942d2a3196507c5a110335f3e216c784c31cc677912ab65d344d6a02e6a887ef821bd96eb69885632e73f172
|
@@ -21,16 +21,6 @@ module PennMARC
|
|
21
21
|
}.uniq
|
22
22
|
end
|
23
23
|
|
24
|
-
# Get "Contained in" values from {https://www.oclc.org/bibformats/en/7xx/773.html MARC 773}
|
25
|
-
# subfield g for related parts.
|
26
|
-
# @param record [MARC::Record]
|
27
|
-
# @return [Array<String>] related parts values for display
|
28
|
-
def contained_in_related_parts_show(record)
|
29
|
-
record.fields('773').map { |field|
|
30
|
-
join_subfields(field, &subfield_in?(%w[g]))
|
31
|
-
}.uniq
|
32
|
-
end
|
33
|
-
|
34
24
|
# Get "chronology" information from specially-prefixed 650 (subject) fields
|
35
25
|
# @todo why do we stuff chronology data in a 650 field?
|
36
26
|
# @param record [MARC::Record]
|
@@ -123,7 +123,7 @@ module PennMARC
|
|
123
123
|
}.first
|
124
124
|
return unless field
|
125
125
|
|
126
|
-
values = title_values(field)
|
126
|
+
values = title_values(field, include_subfield_c: true)
|
127
127
|
[format_title(values[:title_or_form]), values[:punctuation], values[:other_info]].compact_blank.join(' ')
|
128
128
|
end
|
129
129
|
|
@@ -253,17 +253,17 @@ module PennMARC
|
|
253
253
|
|
254
254
|
# Extract title values from provided 245 subfields. Main title components are the following:
|
255
255
|
# - title_or_form: subfields a and k
|
256
|
-
# -
|
257
|
-
# - other_info: subfields b, n, and p
|
256
|
+
# - other_info: subfields b, n, and p (for alternate title, include subfield c)
|
258
257
|
# https://www.oclc.org/bibformats/en/2xx/245.html
|
259
258
|
#
|
260
259
|
# @param field [MARC::Field]
|
260
|
+
# @param include_subfield_c [Boolean]
|
261
261
|
# @return [Hash] title values
|
262
|
-
def title_values(field)
|
262
|
+
def title_values(field, include_subfield_c: false)
|
263
263
|
title_or_form = field.find_all(&subfield_in?(%w[a k]))
|
264
264
|
.map { |sf| trim_trailing(:comma, trim_trailing(:slash, sf.value).rstrip) }
|
265
265
|
.first || ''
|
266
|
-
other_info = field.find_all(&subfield_in?(%w[b n p]))
|
266
|
+
other_info = field.find_all(&subfield_in?(include_subfield_c ? %w[b c n p] : %w[b n p]))
|
267
267
|
.map { |sf| trim_trailing(:slash, sf.value) }
|
268
268
|
.join(' ')
|
269
269
|
title_punctuation = title_or_form.last
|
@@ -1628,6 +1628,10 @@ vpfolio:
|
|
1628
1628
|
specific_location: Van Pelt - Folios
|
1629
1629
|
library: Van Pelt-Dietrich Library Center
|
1630
1630
|
display: Van Pelt - Folios
|
1631
|
+
vpglobalin:
|
1632
|
+
specific_location: Van Pelt - Global Indigeneity Display
|
1633
|
+
library: Van Pelt-Dietrich Library Center
|
1634
|
+
display: Van Pelt - Global Indigeneity Display -- First Floor, Near New Books
|
1631
1635
|
vpjuv:
|
1632
1636
|
specific_location: Van Pelt - Notable Juvenile Books
|
1633
1637
|
library: Van Pelt-Dietrich Library Center
|
data/lib/pennmarc/version.rb
CHANGED
@@ -16,16 +16,6 @@ describe 'PennMARC::Relation' do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe '.contained_in_related_parts_show' do
|
20
|
-
let(:fields) do
|
21
|
-
[marc_field(tag: '773', subfields: { g: 'Vol. 24, pt. B no. 9 (Sept. 1993)', q: '24:B:9<235' })]
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns only the specified subfields' do
|
25
|
-
expect(helper.contained_in_related_parts_show(record)).to eq ['Vol. 24, pt. B no. 9 (Sept. 1993)']
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
19
|
describe '.chronology_show' do
|
30
20
|
let(:fields) do
|
31
21
|
[marc_field(tag: '650', indicator2: '4', subfields: { a: 'CHR Heading' }),
|
@@ -117,6 +117,15 @@ describe 'PennMARC::Title' do
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
context 'with ǂa, ǂc and ǂn defined' do
|
121
|
+
let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
|
122
|
+
let(:subfields) { { a: 'Five Decades of MARC usage', c: 'Should not be shown', n: 'Part One' } }
|
123
|
+
|
124
|
+
it 'returns single title value with text from ǂa and ǂn but not #c' do
|
125
|
+
expect(helper.show(record)).to eq 'Five Decades of MARC usage Part One'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
120
129
|
context 'with no ǂa but a ǂk and ǂn defined' do
|
121
130
|
let(:fields) { [marc_field(tag: '245', subfields: subfields)] }
|
122
131
|
let(:subfields) { { k: 'journals', n: 'Part One' } }
|
@@ -182,17 +191,29 @@ describe 'PennMARC::Title' do
|
|
182
191
|
end
|
183
192
|
|
184
193
|
describe '.alternate_show' do
|
185
|
-
let(:fields) do
|
186
|
-
[marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' }),
|
187
|
-
marc_field(tag: '880', subfields: { '6': '245', k: 'Lettres', b: 'à Lewis Mumford.' })]
|
188
|
-
end
|
189
|
-
|
190
194
|
context 'with subfields ǂk and ǂb' do
|
195
|
+
let(:fields) do
|
196
|
+
[marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' }),
|
197
|
+
marc_field(tag: '880', subfields: { '6': '245', k: 'Lettres', b: 'à Lewis Mumford.' })]
|
198
|
+
end
|
199
|
+
|
191
200
|
it 'returns alternate title values' do
|
192
201
|
expect(helper.alternate_show(record)).to eq 'Lettres à Lewis Mumford.'
|
193
202
|
end
|
194
203
|
end
|
195
204
|
|
205
|
+
context 'with subfields ǂk, ǂb and ǂc' do
|
206
|
+
let(:fields) do
|
207
|
+
[marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' }),
|
208
|
+
marc_field(tag: '880', subfields: { '6': '245', k: 'Lettres',
|
209
|
+
b: 'à Lewis Mumford.', c: 'Additional copy' })]
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'returns alternate title values' do
|
213
|
+
expect(helper.alternate_show(record)).to eq 'Lettres à Lewis Mumford. Additional copy'
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
196
217
|
context 'when 880 field is not present' do
|
197
218
|
let(:fields) do
|
198
219
|
[marc_field(tag: '245', subfields: { k: 'Letters', b: 'to Lewis Mumford. ' })]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennmarc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kanning
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2025-01-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|