pennmarc 1.4.4 → 1.4.6

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: d4a2e39c878c88cf1cdfdf3c72a102c8bb9b5677939e70b6e6824f0d027acfa3
4
- data.tar.gz: 062afb834246c65bedf207c28c5e8ea81d73926b36631be963a31459548537b4
3
+ metadata.gz: e7fc0d8c3919655fd8c163b6cbe4da2b38e2988238532fe24dc8f62d784fb5ab
4
+ data.tar.gz: a9a907d91af9f7cffb42147803137bb9d7bca7cdc553a749575684bc3b96381b
5
5
  SHA512:
6
- metadata.gz: 77c4b9f5133f7be9142970428718a634d762e120c04d3feed44c5a50b76415f81adc41b4c5ca1a31fe155bd0d7e80abf013fd7b843d52e20d3fbf2f837770326
7
- data.tar.gz: 3e74b0b50f37762ebb4c20ea3816a05f4664cecdc4084a535c10bb6db34c25a3a8545d25e726632031cc327d6dcf4a61dd8555e4e119a6060e663b128823558e
6
+ metadata.gz: ffe68635b6ccb154b26edb8cc65a381fff97db77d284a20b8d5643d96895288d6e0caae592a2ae897d500bcdfd1b3a0c2fb9df5c8abcf3809010a9c146ec5dbf
7
+ data.tar.gz: '09cf7165edcf2031a921517dd4cdb9364faed586a53c88f9fde8d6e0d79d4fefe7ba8a5a2e4ca7f69cf50dfef22e82b3fc4001d0a64c39c520f8f71ebae4f5ab'
@@ -85,7 +85,12 @@ module PennMARC
85
85
  # any of these
86
86
  formats << MANUSCRIPT if include_manuscripts?(format_code)
87
87
  formats << ARCHIVE if archive?(record)
88
- formats << MICROFORMAT if micro_or_microform?(call_nums(record), f007, f008, media_type, title_medium)
88
+
89
+ if micro_or_microform?(micro_code(record.leader, f006_forms, f008),
90
+ call_nums(record), f007, media_type, title_medium)
91
+ formats << MICROFORMAT
92
+ end
93
+
89
94
  formats << THESIS_DISSERTATION if thesis_or_dissertation?(format_code, record)
90
95
  formats << CONFERENCE_EVENT if conference_event?(record)
91
96
  formats << NEWSPAPER if newspaper?(f008, format_code)
@@ -275,14 +280,28 @@ module PennMARC
275
280
  record.fields('502').any? && format_code.in?(%w[am tm dm])
276
281
  end
277
282
 
283
+ # @param leader [String]
284
+ # @param f006_forms [Array<String>]
285
+ # @param f008 [String]
286
+ # @return [String]
287
+ def micro_code(leader, f006_forms, f008)
288
+ map_or_visual = %w[e g k r]
289
+
290
+ if map_or_visual.include?(leader[6]) || f006_forms.any? { |str| map_or_visual.include?(str) }
291
+ f008[29] || ' '
292
+ else
293
+ f008[23] || ' '
294
+ end
295
+ end
296
+
297
+ # @param micro_code [String]
278
298
  # @param call_nums [Array<String>]
279
299
  # @param f007 [Array<String>]
280
- # @param f008 [String]
281
300
  # @param title_medium [Array<String>]
282
301
  # @param media_type [Array<String>]
283
302
  # @return [Boolean]
284
- def micro_or_microform?(call_nums, f007, f008, media_type, title_medium)
285
- [f008[23], f008[29]].any? { |v| v.in?(%w[a b c]) } ||
303
+ def micro_or_microform?(micro_code, call_nums, f007, media_type, title_medium)
304
+ %w[a b c].include?(micro_code) ||
286
305
  f007.any? { |v| v.start_with?('h') } ||
287
306
  title_medium.any? { |val| val =~ /micro/i } ||
288
307
  call_nums.any? { |val| val =~ /micro/i } ||
@@ -43,18 +43,13 @@ module PennMARC
43
43
  }.uniq
44
44
  end
45
45
 
46
- # Genre values for faceting. We only set Genre facet values for movies (videos) and manuscripts(?), and ensure
47
- # that the headings come from our set of approved ontologies.
46
+ # Genre values for faceting.
47
+ # @note Prior to 5/2026, we only set Genre facet values for movies (videos) and manuscripts.
48
48
  # @todo the Genre facet in Franklin is pretty ugly. It could be cleaned up by limiting the subfields included
49
49
  # here and cleaning up punctuation.
50
50
  # @param record [MARC::Record]
51
51
  # @return [Array<String>]
52
52
  def facet(record)
53
- format_code = record.leader[6] || ' '
54
- manuscript = Format.include_manuscripts?(format_code)
55
- video = record.fields('007').any? { |field| field.value.starts_with? 'v' }
56
- return [] unless manuscript || video
57
-
58
53
  record.fields('655').filter_map { |field|
59
54
  next unless allowed_genre_field?(field)
60
55
 
@@ -317,7 +317,7 @@ cjsfol:
317
317
  library: Library at the Katz Center for Advanced Judaic Studies
318
318
  display: Library at the Katz Center - Stacks Folio
319
319
  cjsgf:
320
- specific_location: Library at the Katz Center - Rare Book Room
320
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
321
321
  library:
322
322
  - Special Collections
323
323
  - Library at the Katz Center for Advanced Judaic Studies
@@ -338,7 +338,7 @@ cjshur:
338
338
  display: Library at the Katz Center - Hurowitz Collection
339
339
  aeon: true
340
340
  cjsincun:
341
- specific_location: Library at the Katz Center - Rare Book Room
341
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
342
342
  library:
343
343
  - Special Collections
344
344
  - Library at the Katz Center for Advanced Judaic Studies
@@ -351,7 +351,7 @@ cjsinproc:
351
351
  - Library at the Katz Center for Advanced Judaic Studies
352
352
  display: Library at the Katz Center - Processing
353
353
  cjsinprocn:
354
- specific_location: Library at the Katz Center - Rare Book Room
354
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
355
355
  library:
356
356
  - Special Collections
357
357
  - Library at the Katz Center for Advanced Judaic Studies
@@ -407,77 +407,77 @@ cjspergal:
407
407
  library: Library at the Katz Center for Advanced Judaic Studies
408
408
  display: Library at the Katz Center - Periodicals Gallery
409
409
  cjsrar:
410
- specific_location: Library at the Katz Center - Rare Book Room
410
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
411
411
  library:
412
412
  - Special Collections
413
413
  - Library at the Katz Center for Advanced Judaic Studies
414
- display: Library at the Katz Center - Rare Book Room
414
+ display: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
415
415
  aeon: true
416
416
  cjsraram:
417
- specific_location: Library at the Katz Center - Rare Book Room
417
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
418
418
  library:
419
419
  - Special Collections
420
420
  - Library at the Katz Center for Advanced Judaic Studies
421
421
  display: Library at the Katz Center - Rare Book Americana
422
422
  aeon: true
423
423
  cjsrarbx1:
424
- specific_location: Library at the Katz Center - Rare Book Room
424
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
425
425
  library:
426
426
  - Special Collections
427
427
  - Library at the Katz Center for Advanced Judaic Studies
428
428
  display: Library at the Katz Center - Rare Book Box 1
429
429
  aeon: true
430
430
  cjsrarbx2:
431
- specific_location: Library at the Katz Center - Rare Book Room
431
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
432
432
  library:
433
433
  - Special Collections
434
434
  - Library at the Katz Center for Advanced Judaic Studies
435
435
  display: Library at the Katz Center - Rare Book Box 2
436
436
  aeon: true
437
437
  cjsrarbx3:
438
- specific_location: Library at the Katz Center - Rare Book Room
438
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
439
439
  library:
440
440
  - Special Collections
441
441
  - Library at the Katz Center for Advanced Judaic Studies
442
442
  display: Library at the Katz Center - Rare Book Box 3
443
443
  aeon: true
444
444
  cjsrarbx4:
445
- specific_location: Library at the Katz Center - Rare Book Room
445
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
446
446
  library:
447
447
  - Special Collections
448
448
  - Library at the Katz Center for Advanced Judaic Studies
449
449
  display: Library at the Katz Center - Rare Book Box 4
450
450
  aeon: true
451
451
  cjsrarfol:
452
- specific_location: Library at the Katz Center - Rare Book Room
452
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
453
453
  library:
454
454
  - Special Collections
455
455
  - Library at the Katz Center for Advanced Judaic Studies
456
456
  display: Library at the Katz Center - Rare Book Folio
457
457
  aeon: true
458
458
  cjsrargiga:
459
- specific_location: Library at the Katz Center - Rare Book Room
459
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
460
460
  library:
461
461
  - Special Collections
462
462
  - Library at the Katz Center for Advanced Judaic Studies
463
463
  display: Library at the Katz Center - Rare Book Giant
464
464
  aeon: true
465
465
  cjsrarmini:
466
- specific_location: Library at the Katz Center - Rare Book Room
466
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
467
467
  library:
468
468
  - Special Collections
469
469
  - Library at the Katz Center for Advanced Judaic Studies
470
470
  display: Library at the Katz Center - Rare Book Miniature
471
471
  aeon: true
472
472
  cjsrarms:
473
- specific_location: Library at the Katz Center - Rare Book Room
473
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
474
474
  library:
475
475
  - Special Collections
476
476
  - Library at the Katz Center for Advanced Judaic Studies
477
477
  display: Library at the Katz Center - Rare Book Manuscript
478
478
  aeon: true
479
479
  cjsrarover:
480
- specific_location: Library at the Katz Center - Rare Book Room
480
+ specific_location: Library at the Katz Center - Ione Apfelbaum & Hilary Strauss Rare Book Room
481
481
  library:
482
482
  - Special Collections
483
483
  - Library at the Katz Center for Advanced Judaic Studies
@@ -1220,12 +1220,12 @@ scinc:
1220
1220
  display: Kislak Center for Special Collections - Incunables
1221
1221
  aeon: true
1222
1222
  sckatzstor:
1223
- specific_location: LIBRA Rare Library at the Katz Center
1223
+ specific_location: LIBRA - Rare Library at the Katz Center
1224
1224
  library:
1225
1225
  - Special Collections
1226
1226
  - LIBRA
1227
1227
  - Library at the Katz Center for Advanced Judaic Studies
1228
- display: LIBRA Rare Library at the Katz Center
1228
+ display: LIBRA - Rare Library at the Katz Center
1229
1229
  aeon: true
1230
1230
  sclea:
1231
1231
  specific_location: Kislak Center for Special Collections - Lea Collection
@@ -1361,12 +1361,19 @@ scstor:
1361
1361
  - LIBRA
1362
1362
  display: LIBRA - Rare Book Collection Storage
1363
1363
  aeon: true
1364
+ scstorcomx:
1365
+ specific_location: LIBRA - Rare Comics Collection
1366
+ library:
1367
+ - Special Collections
1368
+ - LIBRA
1369
+ display: LIBRA - Rare Comics Collection
1370
+ aeon: true
1364
1371
  scstorvil:
1365
- specific_location: LIBRA Vilain-Wieck Collection
1372
+ specific_location: LIBRA - Vilain-Wieck Collection
1366
1373
  library:
1367
1374
  - Special Collections
1368
1375
  - LIBRA
1369
- display: LIBRA Vilain-Wieck Collection
1376
+ display: LIBRA - Vilain-Wieck Collection
1370
1377
  aeon: true
1371
1378
  scteer:
1372
1379
  specific_location: Kislak Center for Special Collections - Teerink Collection
@@ -1377,12 +1384,11 @@ scteer:
1377
1384
  display: Kislak Center for Special Collections - Teerink Collection
1378
1385
  aeon: true
1379
1386
  sctehon:
1380
- specific_location: Kislak Center for Special Collections - Tehon Collection
1387
+ specific_location: LIBRA - Tehon Collection
1381
1388
  library:
1382
1389
  - Special Collections
1383
- - Kislak Center for Special Collections
1384
- - Van Pelt-Dietrich Library Center
1385
- display: Kislak Center for Special Collections - Tehon Collection
1390
+ - LIBRA
1391
+ display: LIBRA - Tehon Collection
1386
1392
  aeon: true
1387
1393
  sctress:
1388
1394
  specific_location: Kislak Center for Special Collections - Arthur Tress Collection
@@ -1432,41 +1438,41 @@ storcrstxt:
1432
1438
  - GIC Collection
1433
1439
  display: GIC Collection at Penn Libraries
1434
1440
  storfine:
1435
- specific_location: LIBRA Fisher Fine Arts
1441
+ specific_location: LIBRA - Fisher Fine Arts
1436
1442
  library: LIBRA
1437
- display: LIBRA Fisher Fine Arts
1443
+ display: LIBRA - Fisher Fine Arts
1438
1444
  aeon: true
1439
1445
  storm:
1440
1446
  specific_location: LIBRA
1441
1447
  library: LIBRA
1442
1448
  display: LIBRA - Music
1443
1449
  storlimit:
1444
- specific_location: LIBRA Limited
1450
+ specific_location: LIBRA - Limited
1445
1451
  library:
1446
1452
  - Special Collections
1447
1453
  - LIBRA
1448
- display: LIBRA Limited
1454
+ display: LIBRA - Limited
1449
1455
  aeon: true
1450
1456
  storrare:
1451
- specific_location: LIBRA Rare
1457
+ specific_location: LIBRA - Rare
1452
1458
  library:
1453
1459
  - Special Collections
1454
1460
  - LIBRA
1455
- display: LIBRA Rare
1461
+ display: LIBRA - Rare
1456
1462
  aeon: true
1457
1463
  storspec:
1458
- specific_location: LIBRA Special
1464
+ specific_location: LIBRA - Special
1459
1465
  library:
1460
1466
  - Special Collections
1461
1467
  - LIBRA
1462
- display: LIBRA Special
1468
+ display: LIBRA - Special
1463
1469
  aeon: true
1464
1470
  scrunning:
1465
- specific_location: LIBRA Running Press Collection
1471
+ specific_location: LIBRA - Running Press Collection
1466
1472
  library:
1467
1473
  - Special Collections
1468
1474
  - LIBRA
1469
- display: LIBRA Running Press Collection
1475
+ display: LIBRA - Running Press Collection
1470
1476
  aeon: true
1471
1477
  univarch:
1472
1478
  specific_location: University Archives
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.4.4'
4
+ VERSION = '1.4.6'
5
5
  end
@@ -106,11 +106,11 @@ describe 'PennMARC::Format' do
106
106
  end
107
107
  end
108
108
 
109
- context 'with 008 field and valid value at position 23' do
109
+ context 'with non-map/visual record (LDR06 and 006/00 not egkr) and 008 field valid value at position 23' do
110
110
  let(:record) do
111
- marc_record fields: [
112
- marc_control_field(tag: '008', value: ' a')
113
- ]
111
+ marc_record leader: ' h',
112
+ fields: [marc_control_field(tag: '006', value: 'c '),
113
+ marc_control_field(tag: '008', value: ' a')]
114
114
  end
115
115
 
116
116
  it 'returns "Microformat"' do
@@ -118,11 +118,23 @@ describe 'PennMARC::Format' do
118
118
  end
119
119
  end
120
120
 
121
- context 'with 008 field and valid value at position 29' do
121
+ context 'with map/visual record (LDR06 value egkr) and 008 field valid value at position 29' do
122
122
  let(:record) do
123
- marc_record fields: [
124
- marc_control_field(tag: '008', value: ' a')
125
- ]
123
+ marc_record leader: ' k',
124
+ fields: [marc_control_field(tag: '008', value: ' b')]
125
+ end
126
+
127
+ it 'returns "Microformat"' do
128
+ expect(formats).to contain_exactly('Microformat')
129
+ end
130
+ end
131
+
132
+ context 'with map/visual record (LDR06 not egkr but 006/00 is), and 008 field valid value at position 29' do
133
+ let(:record) do
134
+ marc_record leader: ' h',
135
+ fields: [marc_control_field(tag: '006', value: 'a '),
136
+ marc_control_field(tag: '006', value: 'g '),
137
+ marc_control_field(tag: '008', value: ' c')]
126
138
  end
127
139
 
128
140
  it 'returns "Microformat"' do
@@ -42,44 +42,17 @@ describe 'PennMARC::Genre' do
42
42
 
43
43
  describe '.facet' do
44
44
  let(:values) { helper.facet(record) }
45
-
46
- context 'with a non-video, non-manuscript record' do
47
- let(:fields) do
48
- [marc_control_field(tag: '007', value: 'x'),
49
- marc_field(tag: 'hld', subfields: { c: 'vanp' }),
50
- marc_field(tag: '655', indicator2: '0', subfields: { a: 'Genre.' })]
51
- end
52
-
53
- it 'returns no genre values for faceting' do
54
- expect(values).to be_empty
55
- end
56
- end
57
-
58
- context 'with a video record' do
59
- let(:fields) do
60
- [marc_control_field(tag: '007', value: 'v'),
61
- marc_field(tag: 'hld', subfields: { c: 'vanp' }),
62
- marc_field(tag: '655', indicator2: '0', subfields: { a: 'Documentary films' }),
63
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Sports', '2': 'fast' }),
64
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Le cyclisme', '2': 'qlsp' }), # excluded due to sf2
65
- marc_field(tag: '655', indicator2: '1', subfields: { a: 'Shredding' })] # excluded, invalid indicator value
66
- end
67
-
68
- it 'contains only the desired genre facet values' do
69
- expect(values).to contain_exactly 'Documentary films', 'Sports'
70
- end
45
+ let(:fields) do
46
+ [marc_control_field(tag: '007', value: 'v'),
47
+ marc_field(tag: 'hld', subfields: { c: 'vanp' }),
48
+ marc_field(tag: '655', indicator2: '0', subfields: { a: 'Documentary films' }),
49
+ marc_field(tag: '655', indicator2: '7', subfields: { a: 'Sports', '2': 'fast' }),
50
+ marc_field(tag: '655', indicator2: '7', subfields: { a: 'Le cyclisme', '2': 'qlsp' }), # excluded due to sf2
51
+ marc_field(tag: '655', indicator2: '1', subfields: { a: 'Shredding' })] # excluded, invalid indicator value
71
52
  end
72
53
 
73
- context 'with a manuscript record' do
74
- let(:record) { marc_record fields: fields, leader: ' t' }
75
- let(:fields) do
76
- [marc_control_field(tag: '007', value: 'x'),
77
- marc_field(tag: '655', indicator2: '7', subfields: { a: 'Astronomy', '2': 'fast' })]
78
- end
79
-
80
- it 'returns the expected genre values' do
81
- expect(values).to contain_exactly 'Astronomy'
82
- end
54
+ it 'contains only the genre facet values from approved ontologies' do
55
+ expect(values).to contain_exactly 'Documentary films', 'Sports'
83
56
  end
84
57
  end
85
58
  end
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.4
4
+ version: 1.4.6
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-03-26 00:00:00.000000000 Z
15
+ date: 2026-06-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport