pennmarc 1.4.9 → 1.4.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ee4c96f758d430badc9594ba3b31ad1abd2d8b5b92f80cd681fe4fbe053a21a
4
- data.tar.gz: 0a28c912baed15e8e5e50256ebd61b7225af8724f1291c84ab5ac9d4a25f8006
3
+ metadata.gz: 8afdbe2c48c9cf22c9d3242757f070996e6181f3d1ac570ece3fdbf04e8c2f5d
4
+ data.tar.gz: 3ddc3f81b9a8152e53aa19430cc45180e30fc89a11f3cda5ebae41cb9c0a275c
5
5
  SHA512:
6
- metadata.gz: 8afaa2eea826782c1390c6691ed32d9475a8263c7155239e820dcb0d1ed99bef861151b676f58cf006fa6999eb1dffb582700d74141167f9b44edfb65a99d249
7
- data.tar.gz: c05fa58a6e4a3ba45ebb6844182c2dd938bd15f7dcd055a1a2a0ae212fac99fc7529724f691b8a8abcd6d37a41eab42f1491325860178f9bab675f9498c944ff
6
+ metadata.gz: 7fd53869a4b48a1d8446a969283c8e60f467952dfc17a7c251ca9ffae767bc4f9a9e04f7dba24a3c6a97aa18856a23b79bb181dadf8766832c6d85fbfa4a3928
7
+ data.tar.gz: 35a12593cd5352b3ffa9de11afa86ef22b7b00d2ae0f48f1e78f961f71a68d50bd694e13baaa41bf85ca25e9877097360405e57619a976fa0e688ef6845856e9
@@ -23,6 +23,8 @@ module PennMARC
23
23
  CONTRIBUTOR_TAGS = %w[700 710].freeze
24
24
  CONTRIBUTOR_DISPLAY_SUBFIELDS = %w[a b c d j q u 3].freeze
25
25
 
26
+ UNIVERSITY_IDENTIFIER = 'PU'
27
+
26
28
  FACET_SOURCE_MAP = {
27
29
  100 => 'abcdjq', 110 => 'abcdjq', 111 => 'abcen',
28
30
  700 => 'abcdjq', 710 => 'abcdjq', 711 => 'abcen',
@@ -127,6 +129,8 @@ module PennMARC
127
129
  def authors_list(record, main_tags_only: false, first_initial_only: false)
128
130
  fields = record.fields(main_tags_only ? TAGS : TAGS + CONTRIBUTOR_TAGS)
129
131
  fields.filter_map { |field|
132
+ next if university_provenance? field
133
+
130
134
  if field['a'].present?
131
135
  name = trim_trailing(:comma, field['a'])
132
136
  first_initial_only ? abbreviate_name(name) : name
@@ -153,6 +157,7 @@ module PennMARC
153
157
  fields.each do |field|
154
158
  next if indicator_2_options.exclude?(field.indicator2) && field.tag.in?(CONTRIBUTOR_TAGS)
155
159
  next if subfield_defined? field, 'i'
160
+ next if university_provenance? field
156
161
 
157
162
  relator = relator(field: field, relator_term_sf: 'e', relator_map: relator_map)
158
163
  relator = 'Contributor' if relator.blank?
@@ -486,6 +491,14 @@ module PennMARC
486
491
  def describes_author?(field)
487
492
  field['4']&.downcase == 'aut' || field['e']&.downcase&.start_with?('author')
488
493
  end
494
+
495
+ # Does the given field describe a contributor representing university provenance. A contributor tag with a '$5'
496
+ # value starting with the university identifier represents university provenance.
497
+ # @param field [MARC::Field]
498
+ # @return [Boolean]
499
+ def university_provenance?(field)
500
+ field.tag.in?(CONTRIBUTOR_TAGS) && subfield_value?(field, '5', /^#{UNIVERSITY_IDENTIFIER}/)
501
+ end
489
502
  end
490
503
  end
491
504
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.4.9'
4
+ VERSION = '1.4.11'
5
5
  end
@@ -192,6 +192,23 @@ describe 'PennMARC::Creator' do
192
192
  'Name ends with comma', 'Name with no comma'
193
193
  end
194
194
  end
195
+
196
+ context 'with university donor/fund provenance' do
197
+ let(:fields) do
198
+ [marc_field(tag: '100', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
199
+ e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
200
+ marc_field(tag: '700', subfields: { a: 'A contributor', e: 'contributor',
201
+ '5': "Does-not-start-with-#{helper::UNIVERSITY_IDENTIFIER}" }),
202
+ marc_field(tag: '700', subfields: { a: 'Important Person Collection', '6': '100', d: '1970-',
203
+ '5': helper::UNIVERSITY_IDENTIFIER }),
204
+ marc_field(tag: '710', subfields: { a: 'Important Person Collection Library', '6': '100', d: '1970-',
205
+ '5': helper::UNIVERSITY_IDENTIFIER })]
206
+ end
207
+
208
+ it 'omits any university donor/fund provenance' do
209
+ expect(helper.authors_list(record)).to contain_exactly 'Surname, Name', 'A contributor'
210
+ end
211
+ end
195
212
  end
196
213
 
197
214
  describe '.contributors_list' do
@@ -245,6 +262,21 @@ describe 'PennMARC::Creator' do
245
262
  ['Translator', ['Einstein, Albert 1970-, Translator']]
246
263
  end
247
264
  end
265
+
266
+ context 'with university donor/fund provenance' do
267
+ let(:fields) do
268
+ [marc_field(tag: '700', subfields: { a: 'Surname, Name', '0': 'http://cool.uri/12345', d: '1900-2000',
269
+ e: 'author.', '4': 'http://cool.uri/vocabulary/relators/aut' }),
270
+ marc_field(tag: '700', subfields: { a: 'Important Person Collection', '6': '100', d: '1970-',
271
+ '5': helper::UNIVERSITY_IDENTIFIER }),
272
+ marc_field(tag: '710', subfields: { a: 'Important Person Collection Library', '6': '100', d: '1970-',
273
+ '5': helper::UNIVERSITY_IDENTIFIER })]
274
+ end
275
+
276
+ it 'omits any university donor/fund provenance' do
277
+ expect(helper.contributors_list(record)).to contain_exactly ['Author', ['Surname, Name']]
278
+ end
279
+ end
248
280
  end
249
281
 
250
282
  describe '.show_facet_map' do
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.4.9
4
+ version: 1.4.11
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: 2026-09-21 00:00:00.000000000 Z
15
+ date: 2026-10-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport