summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-22 22:45:35 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-22 22:45:35 +0000
commit6167e109580de887ce69b1795231aee005e2c786 (patch)
treeabe1a58dcbbccd2c87ddddad27e828fbf1550f7a
parentd8a037db9d9e00a599874b699f7ba1100df17b22 (diff)
url plugin: jump to fragment when grabbing first par of an url with fragment
-rw-r--r--data/rbot/plugins/url.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index bc96341d..cdbe5cc8 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -70,6 +70,10 @@ class UrlPlugin < Plugin
if @bot.config['url.first_par']
partial = resp.partial_body(@bot.config['http.info_bytes'])
logopts[:title] = title = get_title_from_html(partial)
+ if url.fragment and not url.fragment.empty?
+ fragreg = /.*?<a\s+[^>]*name=["']?#{url.fragment}["']?.*?>/im
+ partial.sub!(fragreg,'')
+ end
first_par = Utils.ircify_first_html_par(partial, :strip => title)
unless first_par.empty?
logopts[:extra] = first_par