twitter-text 1.2.0 → 1.2.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.
- data/Rakefile +1 -1
- data/lib/autolink.rb +4 -4
- data/lib/regex.rb +2 -2
- metadata +3 -3
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ require 'digest'
|
|
11
11
|
|
12
12
|
spec = Gem::Specification.new do |s|
|
13
13
|
s.name = "twitter-text"
|
14
|
-
s.version = "1.2.
|
14
|
+
s.version = "1.2.1"
|
15
15
|
s.authors = ["Matt Sanford", "Patrick Ewing", "Ben Cherry", "Britt Selvitelle", "Raffi Krikorian"]
|
16
16
|
s.email = ["matt@twitter.com", "patrick.henry.ewing@gmail.com", "bcherry@gmail.com", "bs@brittspace.com", "raffi@twitter.com"]
|
17
17
|
s.homepage = "http://twitter.com"
|
data/lib/autolink.rb
CHANGED
@@ -83,21 +83,21 @@ module Twitter
|
|
83
83
|
new_text << chunk
|
84
84
|
else
|
85
85
|
new_text << chunk.gsub(Twitter::Regex[:auto_link_usernames_or_lists]) do
|
86
|
-
before, at, user, slash_listname, after = $1, $2, $3, $4, $
|
86
|
+
before, at, user, slash_listname, after = $1, $2, $3, $4, $'
|
87
87
|
if slash_listname && !options[:suppress_lists]
|
88
88
|
# the link is a list
|
89
89
|
chunk = list = "#{user}#{slash_listname}"
|
90
90
|
chunk = yield(list) if block_given?
|
91
|
-
"#{before}#{at}<a class=\"#{options[:url_class]} #{options[:list_class]}\" href=\"#{encode(options[:list_url_base])}#{encode(list.downcase)}\"#{extra_html}>#{encode(chunk)}</a
|
91
|
+
"#{before}#{at}<a class=\"#{options[:url_class]} #{options[:list_class]}\" href=\"#{encode(options[:list_url_base])}#{encode(list.downcase)}\"#{extra_html}>#{encode(chunk)}</a>"
|
92
92
|
else
|
93
93
|
if after =~ Twitter::Regex[:end_screen_name_match]
|
94
94
|
# Followed by something that means we don't autolink
|
95
|
-
"#{before}#{at}#{user}#{slash_listname}
|
95
|
+
"#{before}#{at}#{user}#{slash_listname}"
|
96
96
|
else
|
97
97
|
# this is a screen name
|
98
98
|
chunk = user
|
99
99
|
chunk = yield(chunk) if block_given?
|
100
|
-
"#{before}#{at}<a class=\"#{options[:url_class]} #{options[:username_class]}\" href=\"#{encode(options[:username_url_base])}#{encode(chunk)}\"#{extra_html}>#{encode(chunk)}</a
|
100
|
+
"#{before}#{at}<a class=\"#{options[:url_class]} #{options[:username_class]}\" href=\"#{encode(options[:username_url_base])}#{encode(chunk)}\"#{extra_html}>#{encode(chunk)}</a>"
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
data/lib/regex.rb
CHANGED
@@ -43,12 +43,12 @@ module Twitter
|
|
43
43
|
LATIN_ACCENTS = [(0xc0..0xd6).to_a, (0xd8..0xf6).to_a, (0xf8..0xff).to_a].flatten.pack('U*').freeze
|
44
44
|
REGEXEN[:latin_accents] = /[#{LATIN_ACCENTS}]+/o
|
45
45
|
|
46
|
-
REGEXEN[:end_screen_name_match] =
|
46
|
+
REGEXEN[:end_screen_name_match] = /^#{REGEXEN[:at_signs]}|#{REGEXEN[:latin_accents]}/o
|
47
47
|
|
48
48
|
# Characters considered valid in a hashtag but not at the beginning, where only a-z and 0-9 are valid.
|
49
49
|
HASHTAG_CHARACTERS = /[a-z0-9_#{LATIN_ACCENTS}]/io
|
50
50
|
REGEXEN[:auto_link_hashtags] = /(^|[^0-9A-Z&\/\?]+)(#|#)([0-9A-Z_]*[A-Z_]+#{HASHTAG_CHARACTERS}*)/io
|
51
|
-
REGEXEN[:auto_link_usernames_or_lists] = /([^a-zA-Z0-9_]|^|RT:?)([@@]+)([a-zA-Z0-9_]{1,20})(\/[a-zA-Z][a-zA-Z0-9_\-]{0,24})
|
51
|
+
REGEXEN[:auto_link_usernames_or_lists] = /([^a-zA-Z0-9_]|^|RT:?)([@@]+)([a-zA-Z0-9_]{1,20})(\/[a-zA-Z][a-zA-Z0-9_\-]{0,24})?/o
|
52
52
|
REGEXEN[:auto_link_emoticon] = /(8\-\#|8\-E|\+\-\(|\`\@|\`O|\<\|:~\(|\}:o\{|:\-\[|\>o\<|X\-\/|\[:-\]\-I\-|\/\/\/\/Ö\\\\\\\\|\(\|:\|\/\)|∑:\*\)|\( \| \))/
|
53
53
|
|
54
54
|
# URL related hash regex collection
|
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: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Sanford
|