cinch-title 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. data/lib/cinch/plugins/title.rb +4 -3
  2. metadata +3 -3
@@ -23,7 +23,8 @@ module Cinch
23
23
  begin
24
24
  next if ignore uri
25
25
 
26
- m.reply "#{m.user.nick}#{suffix} URL: #{parse(uri)}"
26
+ title = parse(uri)
27
+ m.reply "#{m.user.nick}#{suffix} URL: #{title}"
27
28
  rescue URI::InvalidURIError => e
28
29
  m.reply "invalid url: #{uri}"
29
30
  end
@@ -38,14 +39,14 @@ module Cinch
38
39
  easy.max_redirects = config["max_redirects"]
39
40
  end
40
41
  html = Nokogiri::HTML(call.body_str)
41
- title = html.xpath('//title').first
42
+ title = html.at_xpath('//title')
42
43
 
43
44
  return "No title" if title.nil?
44
45
  CGI.unescape_html title.text.gsub(/\s+/, ' ')
45
46
  end
46
47
 
47
48
  def ignore uri
48
- ignore = ["jpg$", "JPG$", "jpeg$", "gif$", "png$", "bmp$", "pdf$"]
49
+ ignore = ["jpg$", "JPG$", "jpeg$", "gif$", "png$", "bmp$", "pdf$", "jpe$"]
49
50
  ignore += config["ignore"] if config.key? "ignore"
50
51
 
51
52
  ignore.each do |re|
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Victor Berg\xC3\xB6\xC3\xB6"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-25 00:00:00 +01:00
17
+ date: 2011-03-26 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency