twitter-text 1.4.10 → 1.4.11
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.
- data/Gemfile.lock +1 -1
- data/lib/regex.rb +2 -2
- data/spec/extractor_spec.rb +9 -5
- data/twitter-text.gemspec +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/lib/regex.rb
CHANGED
|
@@ -97,13 +97,13 @@ module Twitter
|
|
|
97
97
|
regex_range(0x2F800, 0x2FA1F), regex_range(0x3005), regex_range(0x303B) # Kanji (CJK supplement)
|
|
98
98
|
].join('').freeze
|
|
99
99
|
|
|
100
|
-
HASHTAG_BOUNDARY = /(?:\A|\z|#{REGEXEN[:spaces]}
|
|
100
|
+
HASHTAG_BOUNDARY = /(?:\A|\z|#{REGEXEN[:spaces]}|[「」。、.,!?!?:;"'])/
|
|
101
101
|
|
|
102
102
|
# A hashtag must contain latin characters, numbers and underscores, but not all numbers.
|
|
103
103
|
HASHTAG_ALPHA = /[a-z_#{LATIN_ACCENTS}#{NON_LATIN_HASHTAG_CHARS}#{CJ_HASHTAG_CHARACTERS}]/io
|
|
104
104
|
HASHTAG_ALPHANUMERIC = /[a-z0-9_#{LATIN_ACCENTS}#{NON_LATIN_HASHTAG_CHARS}#{CJ_HASHTAG_CHARACTERS}]/io
|
|
105
105
|
|
|
106
|
-
HASHTAG = /(#{HASHTAG_BOUNDARY})(#|#)(#{HASHTAG_ALPHANUMERIC}*#{HASHTAG_ALPHA}#{HASHTAG_ALPHANUMERIC}*)
|
|
106
|
+
HASHTAG = /(#{HASHTAG_BOUNDARY})(#|#)(#{HASHTAG_ALPHANUMERIC}*#{HASHTAG_ALPHA}#{HASHTAG_ALPHANUMERIC}*)/io
|
|
107
107
|
|
|
108
108
|
REGEXEN[:auto_link_hashtags] = /#{HASHTAG}/io
|
|
109
109
|
|
data/spec/extractor_spec.rb
CHANGED
|
@@ -228,11 +228,11 @@ describe Twitter::Extractor do
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
it "should not allow the multiplication character" do
|
|
231
|
-
@extractor.extract_hashtags("#pre#{Twitter::Unicode::U00D7}post").should == []
|
|
231
|
+
@extractor.extract_hashtags("#pre#{Twitter::Unicode::U00D7}post").should == ["pre"]
|
|
232
232
|
end
|
|
233
233
|
|
|
234
234
|
it "should not allow the division character" do
|
|
235
|
-
@extractor.extract_hashtags("#pre#{Twitter::Unicode::U00F7}post").should == []
|
|
235
|
+
@extractor.extract_hashtags("#pre#{Twitter::Unicode::U00F7}post").should == ["pre"]
|
|
236
236
|
end
|
|
237
237
|
end
|
|
238
238
|
|
|
@@ -241,6 +241,10 @@ describe Twitter::Extractor do
|
|
|
241
241
|
it "should not extract numeric hashtags" do
|
|
242
242
|
@extractor.extract_hashtags("#1234").should == []
|
|
243
243
|
end
|
|
244
|
+
|
|
245
|
+
it "should extract hashtag followed by punctuations" do
|
|
246
|
+
@extractor.extract_hashtags("#test1: #test2; #test3\"").should == ["test1", "test2" ,"test3"]
|
|
247
|
+
end
|
|
244
248
|
end
|
|
245
249
|
|
|
246
250
|
describe "hashtags with indices" do
|
|
@@ -283,11 +287,11 @@ describe Twitter::Extractor do
|
|
|
283
287
|
end
|
|
284
288
|
|
|
285
289
|
it "should not allow the multiplication character" do
|
|
286
|
-
|
|
290
|
+
match_hashtag_in_text("pre", "#pre#{[0xd7].pack('U')}post", 0)
|
|
287
291
|
end
|
|
288
292
|
|
|
289
293
|
it "should not allow the division character" do
|
|
290
|
-
|
|
294
|
+
match_hashtag_in_text("pre", "#pre#{[0xf7].pack('U')}post", 0)
|
|
291
295
|
end
|
|
292
296
|
end
|
|
293
297
|
end
|
|
@@ -296,4 +300,4 @@ describe Twitter::Extractor do
|
|
|
296
300
|
not_match_hashtag_in_text("#1234")
|
|
297
301
|
end
|
|
298
302
|
end
|
|
299
|
-
end
|
|
303
|
+
end
|
data/twitter-text.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
|
2
2
|
s.name = "twitter-text"
|
|
3
|
-
s.version = "1.4.
|
|
3
|
+
s.version = "1.4.11"
|
|
4
4
|
s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle",
|
|
5
5
|
"Raffi Krikorian", "J.P. Cummins", "Yoshimasa Niwa", "Keita Fujii"]
|
|
6
6
|
s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com",
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: twitter-text
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 17
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
8
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 1.4.
|
|
9
|
+
- 11
|
|
10
|
+
version: 1.4.11
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Matt Sanford
|
|
@@ -22,7 +22,7 @@ autorequire:
|
|
|
22
22
|
bindir: bin
|
|
23
23
|
cert_chain: []
|
|
24
24
|
|
|
25
|
-
date: 2011-09-
|
|
25
|
+
date: 2011-09-26 00:00:00 -07:00
|
|
26
26
|
default_executable:
|
|
27
27
|
dependencies:
|
|
28
28
|
- !ruby/object:Gem::Dependency
|