diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 17:31:29 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-18 17:31:29 +0000 |
commit | 23129dce2e68fd4723fed01058c50280b9a63ba8 (patch) | |
tree | d06ae3cf7bd5906e97f638a0313ef02e338b9576 /lib/rbot | |
parent | ac1fb6798992c881e5997f1ae00a9924761918dd (diff) |
first_html_par: constify the 'after par' searches with Hpricot
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/utils.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index b9c213f2..335d0506 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -305,6 +305,12 @@ end begin require 'hpricot' + module ::Irc + module Utils + AFTER_PAR_PATH = /^(?:div|span|td|tr|tbody|table)$/ + AFTER_PAR_CLASS = /body|message|text/i + end + end rescue LoadError gems = nil begin @@ -553,7 +559,7 @@ module ::Irc if by_span.nil? by_span = Hpricot::Elements[] doc.root.search("*") { |el| - by_span.push el if el.pathname =~ /^(?:div|span|td|tr|tbody|table)$/ and el[:class] =~ /body|message|text/i + by_span.push el if el.pathname =~ AFTER_PAR_PATH and (el[:class] =~ AFTER_PAR_CLASS or el[:id] =~ AFTER_PAR_CLASS) } debug "other \#1: found: #{by_span.pretty_inspect}" end |