borrow_direct 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/borrow_direct/generate_query.rb +13 -3
- data/lib/borrow_direct/version.rb +1 -1
- data/test/generate_query_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWQyOTk1Y2ViNGM5ZTUyYTljZWRjMTEwNTlkMzcxZGEzM2ViNDJkOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGMwOWQ2ODJlODI5MTk3NDNhYWZlMDY1ZDZjZTAzYjg3YWJhNjg4Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWU4N2IzYjM5M2EwMGJmZTU1ZTkxNzRmMTBiZDBmOTYyYmVlMTk0MDIwMDJm
|
10
|
+
ODBiMTBiNzA1OWNlOGFmZjNhNmQzMzM4YzI5ZjQzYzEwZTc3NzU3NzNhNTE2
|
11
|
+
YTdhMTRmODcyZjZkMzZlNDhjNmJkNTVkMzYzNjgyNzc4MTVhOGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODg1YjdjM2M2ZTkxMzIzMDljZDZkMGEyNzUzMzBmNjA3MmNkYWU5OWFmNDNl
|
14
|
+
YjRhYzYwZmFhNjQ1M2YzMzMxMWFlNjhlZDQ0YWYzMjIyYjFlMmM4OWZjYWE1
|
15
|
+
MTY1ODE0Y2YyYTM2OTlhZjhiMzQyMWVjMWZkYzI4ZjMwODAwZTE=
|
@@ -99,9 +99,19 @@ module BorrowDirect
|
|
99
99
|
# before the first colon OR semi-colon
|
100
100
|
title.sub!(/[\:\;](.*)$/, '')
|
101
101
|
|
102
|
-
|
103
|
-
#
|
104
|
-
|
102
|
+
|
103
|
+
# We want to remove anything that isn't a letter, number, or apostrophe.
|
104
|
+
# Other punctuation and weird chars don't help our query.
|
105
|
+
# We want to do it in a way that's unicode-aware.
|
106
|
+
#
|
107
|
+
# This is harder than expected, as ruby regex unicode-aware character
|
108
|
+
# classes don't seem to handle combining diacritics well.
|
109
|
+
#
|
110
|
+
# This crazy way does it, replace anything that matches unicode
|
111
|
+
# space (may include more than just ascii ' ') or punct class, unless it's an apostrophe --
|
112
|
+
# and replaces them with plain ascii space. (apostrophes are allowed to make it through,
|
113
|
+
# for possessive use)
|
114
|
+
title.gsub!(/[[:space:][:punct:]&&[^\']]/, ' ')
|
105
115
|
|
106
116
|
# compress any remaining whitespace
|
107
117
|
title.strip!
|
data/test/generate_query_test.rb
CHANGED
@@ -130,6 +130,17 @@ describe "GenerateQuery" do
|
|
130
130
|
query = assert_bd_query_url(url)
|
131
131
|
end
|
132
132
|
|
133
|
+
it "handles combining diacritics" do
|
134
|
+
# Some of the code we started with had a problem with combining diacritics.
|
135
|
+
a_acute_combined = [97, 204, 129].pack("c*").force_encoding("UTF-8")
|
136
|
+
|
137
|
+
orig_title = "Vel#{a_acute_combined}squez's stuff...."
|
138
|
+
|
139
|
+
normalized_title = @generator.normalized_title(orig_title)
|
140
|
+
|
141
|
+
assert_equal "vel#{a_acute_combined}squez's stuff", normalized_title
|
142
|
+
end
|
143
|
+
|
133
144
|
|
134
145
|
|
135
146
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: borrow_direct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|