pennmarc 1.2.6 → 1.2.8

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: bc89ffad46c996296dc5cd84d8a2b9c81b82653b24c9d16f6aa9e12c9c3c6aaa
4
- data.tar.gz: 5e1f488f73b07970e4242a7bbffb1536db2f800e73db72d4ad9b33d75375ad38
3
+ metadata.gz: 3b8115ac66bc671e876756b8f20e16fe119373cce76cd17cf00e94d9d9a5c1ad
4
+ data.tar.gz: 584620d7645a8cef217415def55a66f3f611fb4e9611d61d4e5b330dbe21bf2e
5
5
  SHA512:
6
- metadata.gz: 61a8aded7159b786a45213d03c4eb17b60eced7dba21e79b8b634a03bccdcd7f1e312f5205431e3215a95fbdba91ad60611312a03939f3c03bfc39b85dc5dc88
7
- data.tar.gz: 756c4a538eedd1fd7b9bc12a347547863ea8674965c3a87669a32ca39d3c50724af0a17e3d1747e7e3a06385a9c6b55aead58d8c5d091996af5c37ed1c1641ba
6
+ metadata.gz: 1a18c1297db9093b61e974cfc8593bdbcf34c55097427a17a6eed60322ee0789efa9c81ed96ee13f7662d617378392aa6409b496f142b07561616d6d02cf0f32
7
+ data.tar.gz: '089da372f1421c4a8dc524c24d245be4b1a80b491a87eb5ed30f7c4feb88329bc6f9981b421fab3638b8bf48012b71d7d2012a4d83a36df804861c2c87af374c'
@@ -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
- # - inclusive_dates: subfield c
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
@@ -160,14 +160,14 @@ vismatl:
160
160
  aeon: true
161
161
  athstor:
162
162
  specific_location: LIBRA - Athenaeum of Philadelphia
163
- library:
163
+ library:
164
164
  - LIBRA
165
165
  - Athenaeum of Philadelphia
166
166
  display: LIBRA - Athenaeum of Philadelphia
167
167
  aeon: true
168
168
  athstorcir:
169
169
  specific_location: LIBRA - Athenaeum of Philadelphia Circulating
170
- library:
170
+ library:
171
171
  - LIBRA
172
172
  - Athenaeum of Philadelphia
173
173
  display: LIBRA - Athenaeum of Philadelphia Circulating
@@ -1272,6 +1272,14 @@ scinc:
1272
1272
  - Van Pelt-Dietrich Library Center
1273
1273
  display: Kislak Center for Special Collections - Incunables
1274
1274
  aeon: true
1275
+ sckatzstor:
1276
+ specific_location: LIBRA Rare Library at the Katz Center
1277
+ library:
1278
+ - Special Collections
1279
+ - LIBRA
1280
+ - Library at the Katz Center for Advanced Judaic Studies
1281
+ display: LIBRA Rare Library at the Katz Center
1282
+ aeon: true
1275
1283
  sclea:
1276
1284
  specific_location: Kislak Center for Special Collections - Lea Collection
1277
1285
  library:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.2.6'
4
+ VERSION = '1.2.8'
5
5
  end
@@ -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.6
4
+ version: 1.2.8
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: 2024-12-20 00:00:00.000000000 Z
15
+ date: 2025-01-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport