earthquake 0.6.8 → 0.6.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/earthquake.gemspec +1 -1
- data/lib/earthquake/ext.rb +2 -2
- data/lib/earthquake/output.rb +3 -3
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.9
|
data/earthquake.gemspec
CHANGED
data/lib/earthquake/ext.rb
CHANGED
@@ -46,8 +46,8 @@ class String
|
|
46
46
|
def coloring(pattern, color = nil, &block)
|
47
47
|
self.gsub(pattern) do |i|
|
48
48
|
applied_colors = self[0...$~.begin(0)].scan(/\e\[[\d;]+m/)
|
49
|
-
color
|
50
|
-
"#{i.c(
|
49
|
+
c = color || block.call(i)
|
50
|
+
"#{i.c(c)}#{applied_colors.join}"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
data/lib/earthquake/output.rb
CHANGED
@@ -54,7 +54,7 @@ module Earthquake
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def color_of(screen_name)
|
57
|
-
config[:colors][screen_name.to_i(36) % config[:colors].size]
|
57
|
+
config[:colors][screen_name.delete("^0-9A-Za-z_").to_i(36) % config[:colors].size]
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -92,8 +92,8 @@ module Earthquake
|
|
92
92
|
|
93
93
|
text = item["text"].u
|
94
94
|
text.gsub!(/\s+/, ' ') unless config[:raw_text]
|
95
|
-
text = text.coloring(/@
|
96
|
-
text = text.coloring(/(
|
95
|
+
text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
|
96
|
+
text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
|
97
97
|
text = text.coloring(URI.regexp(["http", "https"]), :url)
|
98
98
|
|
99
99
|
if item["_highlights"]
|