From 71f81ee086db58b94b69d3e4082cbadec1b7c245 Mon Sep 17 00:00:00 2001 From: Adam James Date: Tue, 4 Mar 2008 16:47:25 +0000 Subject: rss plugin: try to use tags in feeds when possible --- data/rbot/plugins/rss.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'data') diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index d1e17593..5baf43ee 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -16,6 +16,13 @@ require 'rss' +# Try to load rss/content/2.0 so we can access the data in +# tags. +begin + require 'rss/content/2.0' +rescue LoadError +end + module ::RSS # Make an 'unique' ID for a given item, based on appropriate bot options @@ -877,8 +884,12 @@ class RSSFeedsPlugin < Plugin :a_href => :link_out } - if item.respond_to? :description - desc = item.description.ircify_html(desc_opt) if item.description + # We prefer content_encoded here as it tends to provide more html formatting + # for use with ircify_html. + if item.respond_to?(:content_encoded) && item.content_encoded + desc = item.content_encoded.ircify_html(desc_opt) + elsif item.respond_to?(:description) && item.description + desc = item.description.ircify_html(desc_opt) else if item.content.type == "html" desc = item.content.content.ircify_html(desc_opt) -- cgit v1.2.3