From 0c4d227fc55b3051dfbaae519e6f6317f052ebb8 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 7 Feb 2009 00:47:58 +0100 Subject: slashdot plugin: fix filter for multiple articles --- data/rbot/plugins/slashdot.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'data/rbot') 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(" | ") -- cgit v1.2.3