traject_horizon 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/traject/horizon_bib_auth_merge.rb +20 -0
- data/lib/traject_horizon/version.rb +1 -1
- data/test/horizon_bib_auth_merge_test.rb +5 -0
- 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: 5437d552f50c5c1cac65863a57062d0a923003dc
|
4
|
+
data.tar.gz: 465ec4110061d6c7da26c02c83f05ae710fdbd75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 725bfb474a7ca9376e2ba725d201747ae8029bc38fb9a80b9a54508a2a42f1d587f1827ec11615d039b392b15d633a3c03a4cb18a8550bf2855874f5e33d56ea
|
7
|
+
data.tar.gz: 4c0e28e6f2baea56449e4961f642468761d49106cb22f06cb25516be162ab7186dedf570dc69ca083824bfc31cce79f64a2286f61b47f87b818458493eca0f64
|
@@ -10,6 +10,8 @@ module Traject
|
|
10
10
|
class HorizonBibAuthMerge
|
11
11
|
attr_reader :bibtext, :authtext, :tag
|
12
12
|
|
13
|
+
@@up_to_subfield_t_re = /\A(.*)\x1Ft/
|
14
|
+
|
13
15
|
# Pass in bibtext and authtext as String -- you probably need to get
|
14
16
|
# column values from JDBC as bytes and then use String.from_java_bytes
|
15
17
|
# to avoid messing up possible Marc8 encoding.
|
@@ -43,6 +45,13 @@ module Traject
|
|
43
45
|
return bibtext if authtext.nil?
|
44
46
|
|
45
47
|
|
48
|
+
# For 240 and 243, it seems that anything before the first $t should
|
49
|
+
# be ignored in authtext template -- we need to actually remove it,
|
50
|
+
# so later when we append any leftover fields, we don't get those.
|
51
|
+
if tag == '240' || tag == '243'
|
52
|
+
authtext.sub!(@@up_to_subfield_t_re, "\x1Ft")
|
53
|
+
end
|
54
|
+
|
46
55
|
|
47
56
|
# We need to do a crazy combination of template in text with values in authtext.
|
48
57
|
# horizon, you so crazy. text template is like:
|
@@ -114,6 +123,17 @@ module Traject
|
|
114
123
|
end
|
115
124
|
end
|
116
125
|
|
126
|
+
# Sometimes there's leftover text at the end of authtext that wasn't
|
127
|
+
# included in the bibtext template. Horizon's marc reconstruction
|
128
|
+
# seems to just include this on the end, we will too.
|
129
|
+
# Relies on 'prior to $t' fields being removed from 240 and 243 earlier,
|
130
|
+
# to avoid including them when we shouldn't.
|
131
|
+
if authtext.length > 0
|
132
|
+
bibtext << authtext
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
|
117
137
|
# We mutated bibtext to fill in template, now just return it.
|
118
138
|
return bibtext
|
119
139
|
end
|
@@ -55,4 +55,9 @@ describe "HorizonBibAuthMerge" do
|
|
55
55
|
assert_equal "aMiscellaneous publications (Pan American Sanitary Bureau) ;vno. 79.", HzMerge.new("830", "a) ;vno. 79.", "aMiscellaneous publications (Pan American Sanitary Bureau) ;").merge!
|
56
56
|
end
|
57
57
|
|
58
|
+
it "handles extra literals in authtext" do
|
59
|
+
assert_equal "aKapsperger, Giovanni Girolamo,d1580-1651.tArie passeggiate.nlibro 1.pUltimi miei sospiri.",
|
60
|
+
HzMerge.new("700", "a,d.t.", "aKapsperger, Giovanni Girolamo,d1580-1651.tArie passeggiate,nlibro 1.pUltimi miei sospiri.").merge!
|
61
|
+
end
|
62
|
+
|
58
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traject_horizon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: traject
|