stanford-mods 1.0.0 → 1.0.1
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/README.rdoc +1 -0
- data/lib/stanford-mods/searchworks.rb +9 -2
- data/lib/stanford-mods/version.rb +1 -1
- data/spec/searchworks_pub_dates_spec.rb +1 -1
- data/spec/searchworks_subject_spec.rb +1 -1
- data/spec/searchworks_title_spec.rb +63 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a99ffd1547688f19839564988a43e698223bc3ac
|
4
|
+
data.tar.gz: 261a71cbde0d578de0c1b6f43fe329bf531c20ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 996cc6f68f4fb8f3154a21423668e188826c46305ab2cd1445c871f0bcf7a20c0e362332b42ceebdee9be8a70e2ad0420532516356009ef4b7b1c1327e4cb3b3
|
7
|
+
data.tar.gz: 7ebf7b202fd71b7c546fde56f1064092f116e146f023c44a7d4f993ce39db0f88d402306fcdae44f081cffbd82fffdc5aeecb06c764567fc52c5df413ed87ccd
|
data/README.rdoc
CHANGED
@@ -59,6 +59,7 @@ Example Using SearchWorks Mixins:
|
|
59
59
|
6. Create new Pull Request
|
60
60
|
|
61
61
|
== Releases
|
62
|
+
* <b>1.0.1</b> sw_title_display keeps appropriate trailing punct more or less per spec in solrmarc-sw sw_index.properties
|
62
63
|
* <b>1.0.0</b> sw_full_title now includes partName and partNumber; sw_title_display created to be like sw_full_title but without trailing punctuation; sw format for typeOfResource sound recording; genre value is librettos, plural; sw format algorithm accommodates first letter upcase; genre value report does NOT map to a format, genre value 'project report' with ToR text is 'Book'
|
63
64
|
* <b>0.0.27</b> add genres 'Issue brief', 'Book chapter' and 'Working paper' to map to searchworks format 'Book'
|
64
65
|
* <b>0.0.26</b> map typeOfResource 'sound recording-musical' to searchworks format 'Music - Recording' with spaces
|
@@ -151,17 +151,24 @@ module Stanford
|
|
151
151
|
|
152
152
|
result = parts ? preParts + ". " + parts : preParts
|
153
153
|
result += "." if !result.match(/[[:punct:]]$/)
|
154
|
+
result.strip!
|
154
155
|
result = nil if result.empty?
|
155
156
|
result
|
156
157
|
else
|
157
158
|
nil
|
158
159
|
end
|
159
160
|
end
|
160
|
-
|
161
|
+
|
162
|
+
# like sw_full_title without trailing \,/;:.
|
163
|
+
# spec from solrmarc-sw sw_index.properties
|
164
|
+
# title_display = custom, removeTrailingPunct(245abdefghijklmnopqrstuvwxyz, [\\\\,/;:], ([A-Za-z]{4}|[0-9]{3}|\\)|\\,))
|
161
165
|
# @return [String] value for title_display (like title_full_display without trailing punctuation)
|
162
166
|
def sw_title_display
|
163
167
|
result = sw_full_title ? sw_full_title : nil
|
164
|
-
|
168
|
+
if result
|
169
|
+
result.sub!(/[\.,;:\/\\]+$/, '')
|
170
|
+
result.strip!
|
171
|
+
end
|
165
172
|
result
|
166
173
|
end
|
167
174
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe "title fields
|
4
|
+
describe "title fields (searchworks.rb)" do
|
5
5
|
before(:all) do
|
6
6
|
@smods_rec = Stanford::Mods::Record.new
|
7
7
|
@ns_decl = "xmlns='#{Mods::MODS_NS}'"
|
@@ -246,6 +246,64 @@ describe "title fields from Searchworks mixin for Stanford::Mods::Record" do
|
|
246
246
|
end # sw_full_title
|
247
247
|
|
248
248
|
context "sw_title_display removes end punctuation of sw_full_title_display" do
|
249
|
+
|
250
|
+
# title_display = custom, removeTrailingPunct(245abdefghijklmnopqrstuvwxyz, [\\\\,/;:], ([A-Za-z]{4}|[0-9]{3}|\\)|\\,))
|
251
|
+
context "should remove trailing \,/;:." do
|
252
|
+
it "retains other trailing chars" do
|
253
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
254
|
+
<title>The Jerk?</title>
|
255
|
+
</titleInfo></mods>"
|
256
|
+
@smods_rec.from_str(m)
|
257
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk?'
|
258
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
259
|
+
<title>The Jerk!</title>
|
260
|
+
</titleInfo></mods>"
|
261
|
+
@smods_rec.from_str(m)
|
262
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk!'
|
263
|
+
end
|
264
|
+
it "removes trailing comma" do
|
265
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
266
|
+
<title>The Jerk,</title>
|
267
|
+
</titleInfo></mods>"
|
268
|
+
@smods_rec.from_str(m)
|
269
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
270
|
+
end
|
271
|
+
it "removes trailing semicolon" do
|
272
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
273
|
+
<title>The Jerk;</title>
|
274
|
+
</titleInfo></mods>"
|
275
|
+
@smods_rec.from_str(m)
|
276
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
277
|
+
end
|
278
|
+
it "removes trailing colon" do
|
279
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
280
|
+
<title>The Jerk:</title>
|
281
|
+
</titleInfo></mods>"
|
282
|
+
@smods_rec.from_str(m)
|
283
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
284
|
+
end
|
285
|
+
it "removes trailing slash" do
|
286
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
287
|
+
<title>The Jerk /</title>
|
288
|
+
</titleInfo></mods>"
|
289
|
+
@smods_rec.from_str(m)
|
290
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
291
|
+
end
|
292
|
+
it "removes trailing backslash" do
|
293
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
294
|
+
<title>The Jerk \</title>
|
295
|
+
</titleInfo></mods>"
|
296
|
+
@smods_rec.from_str(m)
|
297
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
298
|
+
end
|
299
|
+
it "removes multiple trailing punctuation" do
|
300
|
+
m = "<mods #{@ns_decl}><titleInfo>
|
301
|
+
<title>The Jerk.,\</title>
|
302
|
+
</titleInfo></mods>"
|
303
|
+
@smods_rec.from_str(m)
|
304
|
+
expect(@smods_rec.sw_title_display).to eq 'The Jerk'
|
305
|
+
end
|
306
|
+
end
|
249
307
|
context "no subtitle" do
|
250
308
|
it "end title with a period" do
|
251
309
|
m = "<mods #{@ns_decl}>
|
@@ -272,7 +330,7 @@ describe "title fields from Searchworks mixin for Stanford::Mods::Record" do
|
|
272
330
|
<title>Olympics!</title>
|
273
331
|
</titleInfo></mods>"
|
274
332
|
@smods_rec.from_str(m)
|
275
|
-
expect(@smods_rec.sw_title_display).to eq 'The Olympics'
|
333
|
+
expect(@smods_rec.sw_title_display).to eq 'The Olympics!'
|
276
334
|
end
|
277
335
|
end # no subtitle
|
278
336
|
context "subtitle" do
|
@@ -315,7 +373,7 @@ describe "title fields from Searchworks mixin for Stanford::Mods::Record" do
|
|
315
373
|
<subTitle>a history?</subTitle>
|
316
374
|
</titleInfo></mods>"
|
317
375
|
@smods_rec.from_str(m)
|
318
|
-
expect(@smods_rec.sw_title_display).to eq 'The Olympics : a history'
|
376
|
+
expect(@smods_rec.sw_title_display).to eq 'The Olympics : a history?'
|
319
377
|
end
|
320
378
|
end # subtitle
|
321
379
|
context "partName" do
|
@@ -446,14 +504,14 @@ describe "title fields from Searchworks mixin for Stanford::Mods::Record" do
|
|
446
504
|
<partNumber>Part 1!</partNumber>
|
447
505
|
</titleInfo></mods>"
|
448
506
|
@smods_rec.from_str(m)
|
449
|
-
expect(@smods_rec.sw_title_display).to eq 'The Olympics : a history. Part 1'
|
507
|
+
expect(@smods_rec.sw_title_display).to eq 'The Olympics : a history. Part 1!'
|
450
508
|
m = "<mods #{@ns_decl}>
|
451
509
|
<titleInfo>
|
452
510
|
<title>cfb</title>
|
453
511
|
<partNumber>1894?</partNumber>
|
454
512
|
</titleInfo></mods>"
|
455
513
|
@smods_rec.from_str(m)
|
456
|
-
expect(@smods_rec.sw_title_display).to eq 'cfb. 1894'
|
514
|
+
expect(@smods_rec.sw_title_display).to eq 'cfb. 1894?'
|
457
515
|
end
|
458
516
|
end # no partName but partNumber
|
459
517
|
end # sw_title_display
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stanford-mods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mods
|