pennmarc 1.2.10 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pennmarc/helpers/creator.rb +9 -9
- data/lib/pennmarc/helpers/production.rb +2 -2
- data/lib/pennmarc/mappings/locations.yml +21 -0
- data/lib/pennmarc/version.rb +1 -1
- data/spec/lib/pennmarc/helpers/creator_spec.rb +10 -0
- data/spec/lib/pennmarc/helpers/production_spec.rb +3 -3
- 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: ba9e67db0150db000412aced9bbcfa47109e0a3d9e0077abb634a9aedc6110d2
|
4
|
+
data.tar.gz: 456f88b47a83305f0eb71b2daf5afc8704048e4761ae7f5ef5315b189ee89b85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be56036ff189496fedb33c611578134b39975ea7c779fd73fe941cb26898c7bcbb3485f3a409c4b510f187985ca1a5df42a1309ceaa8b227d1ea261e5b861b1a
|
7
|
+
data.tar.gz: e84d79da22e084545f4d84b37364d39de44a16f4dcf2382d07b16b4a6992c39e9473df58576d9232af00c30d40e20cd96ddcba04352cfd2d9764f9c2a025f535
|
@@ -131,11 +131,7 @@ module PennMARC
|
|
131
131
|
relator = trim_punctuation(relator).capitalize
|
132
132
|
|
133
133
|
name = trim_trailing(:comma, field['a'])
|
134
|
-
name =
|
135
|
-
name
|
136
|
-
else
|
137
|
-
"#{name} #{join_subfields(field, &subfield_in?(%w[b c d j q u 3]))}, #{relator}"
|
138
|
-
end
|
134
|
+
name = "#{name} #{join_subfields(field, &subfield_in?(%w[b c d j q u 3]))}, #{relator}" unless name_only
|
139
135
|
|
140
136
|
if contributors.key?(relator)
|
141
137
|
contributors[relator].push(name)
|
@@ -274,19 +270,23 @@ module PennMARC
|
|
274
270
|
# 'a', 'b', 'c', 'd', 'j', and 'q', 'u', and '3'. Then appends resulting string with any encoded relationships
|
275
271
|
# found in $4. If there are no valid encoded relationships, uses the value found in $e.
|
276
272
|
# @note legacy version returns array of hash objects including data for display link
|
277
|
-
# @todo is it okay to include 880 $4 here? Legacy includes $4 in main author display 880 but not here.
|
278
273
|
# @param record [MARC::Record]
|
279
274
|
# @param relator_map [Hash]
|
275
|
+
# @param name_only [Boolean]
|
276
|
+
# @param vernacular [Boolean]
|
280
277
|
# @return [Array<String>]
|
281
|
-
def contributor_show(record, relator_map: Mappers.relator)
|
278
|
+
def contributor_show(record, relator_map: Mappers.relator, name_only: false, vernacular: true)
|
282
279
|
indicator_2_options = ['', ' ', '0']
|
283
280
|
fields = record.fields(CONTRIBUTOR_TAGS)
|
284
|
-
|
281
|
+
if vernacular
|
282
|
+
fields += record.fields('880').select { |f| subfield_value?(f, '6', /^(#{CONTRIBUTOR_TAGS.join('|')})/) }
|
283
|
+
end
|
284
|
+
sf = name_only ? %w[a] : %w[a b c d j q u 3]
|
285
285
|
fields.filter_map { |field|
|
286
286
|
next if indicator_2_options.exclude?(field.indicator2) && field.tag.in?(CONTRIBUTOR_TAGS)
|
287
287
|
next if subfield_defined? field, 'i'
|
288
288
|
|
289
|
-
contributor = join_subfields(field, &subfield_in?(
|
289
|
+
contributor = join_subfields(field, &subfield_in?(sf))
|
290
290
|
append_relator(field: field, joined_subfields: contributor, relator_term_sf: 'e', relator_map: relator_map)
|
291
291
|
}.uniq
|
292
292
|
end
|
@@ -209,13 +209,13 @@ module PennMARC
|
|
209
209
|
values = record.fields('245').first(1).flat_map { |field| subfield_values(field, 'f') }
|
210
210
|
|
211
211
|
values += record.fields(%w[260 261 262]).first(1).map do |field|
|
212
|
-
join_subfields(field, &subfield_in?([subfield]))
|
212
|
+
trim_punctuation(join_subfields(field, &subfield_in?([subfield])))
|
213
213
|
end
|
214
214
|
|
215
215
|
values += record.fields('264').filter_map do |field|
|
216
216
|
next unless field.indicator2 == '1'
|
217
217
|
|
218
|
-
join_subfields(field, &subfield_in?([subfield]))
|
218
|
+
trim_punctuation(join_subfields(field, &subfield_in?([subfield])))
|
219
219
|
end
|
220
220
|
|
221
221
|
values.compact_blank.uniq
|
@@ -1422,6 +1422,13 @@ scstor:
|
|
1422
1422
|
- Van Pelt-Dietrich Library Center
|
1423
1423
|
display: Kislak Center for Special Collections - Rare Book Collection Storage
|
1424
1424
|
aeon: true
|
1425
|
+
scstorvil:
|
1426
|
+
specific_location: LIBRA Vilain-Wieck Collection
|
1427
|
+
library:
|
1428
|
+
- Special Collections
|
1429
|
+
- LIBRA
|
1430
|
+
display: LIBRA Vilain-Wieck Collection
|
1431
|
+
aeon: true
|
1425
1432
|
scteer:
|
1426
1433
|
specific_location: Kislak Center for Special Collections - Teerink Collection
|
1427
1434
|
library:
|
@@ -1522,6 +1529,13 @@ scrunning:
|
|
1522
1529
|
- LIBRA
|
1523
1530
|
display: LIBRA Running Press Collection
|
1524
1531
|
aeon: true
|
1532
|
+
storvilain:
|
1533
|
+
specific_location: LIBRA Vilain-Wieck Collection
|
1534
|
+
library:
|
1535
|
+
- Special Collections
|
1536
|
+
- LIBRA
|
1537
|
+
display: LIBRA Vilain-Wieck Collection
|
1538
|
+
aeon: true
|
1525
1539
|
univarch:
|
1526
1540
|
specific_location: University Archives
|
1527
1541
|
library: University Archives
|
@@ -1587,6 +1601,13 @@ vetelibr:
|
|
1587
1601
|
- Veterinary
|
1588
1602
|
- 'Veterinary: Atwood Library (Campus)'
|
1589
1603
|
display: 'Veterinary: Atwood Library (Campus) - Librarian''s Office'
|
1604
|
+
vetenewbk:
|
1605
|
+
specific_location: 'Veterinary: Atwood Library (Campus) - New Books'
|
1606
|
+
library:
|
1607
|
+
- Health Sciences Libraries
|
1608
|
+
- Veterinary
|
1609
|
+
- 'Veterinary: Atwood Library (Campus)'
|
1610
|
+
display: 'Veterinary: Atwood Library (Campus) - New Books'
|
1590
1611
|
veteover:
|
1591
1612
|
specific_location: 'Veterinary: Atwood Library (Campus) - Oversize'
|
1592
1613
|
library:
|
data/lib/pennmarc/version.rb
CHANGED
@@ -453,6 +453,16 @@ describe 'PennMARC::Creator' do
|
|
453
453
|
'Alt Name Alt num Alt title Alt date Alt qualifier Alt Fuller Name Alt affiliation Alt material, Alt relator.'
|
454
454
|
)
|
455
455
|
end
|
456
|
+
|
457
|
+
it 'returns contributor name only when called with name_only as true' do
|
458
|
+
values = helper.contributor_show(record, relator_map: mapping, name_only: true)
|
459
|
+
expect(values).to contain_exactly('Name, Author.', 'Alt Name, Alt relator.')
|
460
|
+
end
|
461
|
+
|
462
|
+
it 'returns contributor values without alternatives when called with vernacular as false' do
|
463
|
+
values = helper.contributor_show(record, relator_map: mapping, vernacular: false)
|
464
|
+
expect(values).to contain_exactly('Name I laureate 1968 pseud Fuller Name affiliation materials, Author.')
|
465
|
+
end
|
456
466
|
end
|
457
467
|
|
458
468
|
context 'with a corporate contributor and linked alternate' do
|
@@ -251,9 +251,9 @@ describe 'PennMARC::Production' do
|
|
251
251
|
let(:record) { marc_record fields: fields }
|
252
252
|
let(:fields) do
|
253
253
|
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
254
|
-
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
254
|
+
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England : ', b: 'Longman',
|
255
255
|
c: '1985, c1956.' }),
|
256
|
-
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
256
|
+
marc_field(tag: '264', subfields: { a: 'Leeds,', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
257
257
|
marc_field(tag: '880', subfields: { f: 'Alternate 1800-1850', '6': '245' }),
|
258
258
|
marc_field(tag: '880',
|
259
259
|
subfields: { a: 'Alternate England', b: 'Alternate Longman', c: 'Alternate 1985, c1956.',
|
@@ -273,7 +273,7 @@ describe 'PennMARC::Production' do
|
|
273
273
|
let(:record) { marc_record fields: fields }
|
274
274
|
let(:fields) do
|
275
275
|
[marc_field(tag: '245', subfields: { f: 'between 1800-1850' }),
|
276
|
-
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England', b: 'Longman',
|
276
|
+
marc_field(tag: '260', subfields: { a: ' Burnt Mill, Harlow, Essex, England,', b: 'Longman',
|
277
277
|
c: '1985, c1956.' }),
|
278
278
|
marc_field(tag: '264', subfields: { a: 'Leeds', b: 'Peepal Tree Press', c: '2019' }, indicator2: '1'),
|
279
279
|
marc_field(tag: '880', subfields: { f: 'Alternate 1800-1850', '6': '245' }),
|
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.12
|
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: 2025-
|
15
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|