summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-07 00:47:58 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2009-02-07 00:47:58 +0100
commit0c4d227fc55b3051dfbaae519e6f6317f052ebb8 (patch)
treef8a6192d13df82a9d98866f3139d9d1f86f32f23
parentf6d60942c51ad3cb9fe2a54056a462064570abc3 (diff)
slashdot plugin: fix filter for multiple articles
-rw-r--r--data/rbot/plugins/slashdot.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/data/rbot/plugins/slashdot.rb b/data/rbot/plugins/slashdot.rb
index 71411458..5b3c2f3b 100644
--- a/data/rbot/plugins/slashdot.rb
+++ b/data/rbot/plugins/slashdot.rb
@@ -31,7 +31,20 @@ class SlashdotPlugin < Plugin
if arts.length > 1
tits = []
arts.each { |el|
- artitle = (el/"div.generaltitle").first.to_html.ircify_html
+ # see if the div tag with generaltitle class is present
+ artitle = (el/"div.generaltitle").first
+ if artitle
+ tits << artitle.to_html.ircify_html
+ next
+ end
+ # otherwise, check for skin+datitle a tags
+ datitle = (el/"a.datitle").first
+ next unless datitle
+ skin = (el/"a.skin").first
+ artitle = [
+ skin ? skin.innerHTML.ircify_html : nil,
+ datitle.innerHTML.ircify_html
+ ].compact.join(" ")
tits << artitle
}
content = tits.join(" | ")