termtter 0.8.9 → 0.8.10

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.
@@ -14,5 +14,6 @@ end
14
14
  # keyword.rb
15
15
  # provides a keyword watching method
16
16
  # example config
17
- # configatron.plugins.stdout.timeline_format = '<%= color(time, 90) %> <%= color(status, s.has_keyword ? 4 : status_color) %> <%= color(id, 90) %>'
17
+ # configatron.plugins.stdout.timeline_format = '<% color = s.has_keyword ? 4 : status_color %>' +
18
+ # '<90><%=time%></90> <<%=color%>><%=status%></<%=color%>> <90><%=id%></90>'
18
19
  # configatron.plugins.keyword.keywords = [ /motemen/ ]
@@ -50,12 +50,15 @@ module Termtter
50
50
  return []
51
51
  end
52
52
 
53
+ configatron.search.set_default(:highlihgt_text_format, '<on_magenta><white>\1</white></on_magenta>')
53
54
  def search(query)
54
55
  results = fetch_as_json(search_url_for("/search.json?q=#{CGI.escape(query)}"))['results']
55
56
  return results.map do |s|
56
57
  status = Status.new
57
58
  status.id = s['id']
58
- status.text = CGI.unescapeHTML(s['text']).gsub(/(\n|\r)/, '')
59
+ status.text = s['text'].
60
+ gsub(/(\n|\r)/, '').
61
+ gsub(/(#{Regexp.escape(query)})/i, configatron.search.highlihgt_text_format)
59
62
  status.created_at = Time.parse(s["created_at"])
60
63
  status.user_screen_name = s['from_user']
61
64
  status
@@ -95,7 +98,7 @@ module Termtter
95
98
  %w(id name screen_name url profile_image_url).each do |key|
96
99
  status.__send__("user_#{key}=".to_sym, s["user"][key])
97
100
  end
98
- status.text = CGI.unescapeHTML(status.text).gsub(/(\n|\r)/, '')
101
+ status.text = status.text.gsub(/(\n|\r)/, '')
99
102
  status
100
103
  end
101
104
  end
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Termtter
3
- VERSION = '0.8.9'
3
+ VERSION = '0.8.10'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: termtter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.9
4
+ version: 0.8.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo