diff options
author | Adam James <atj@pulsewidth.org.uk> | 2008-03-04 16:47:25 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-04 17:59:21 +0100 |
commit | 71f81ee086db58b94b69d3e4082cbadec1b7c245 (patch) | |
tree | 10643f9de524671f3560de1dd49378ce2fb6956a | |
parent | 5d2184f862fbad00a0be58ef4709b0e817343098 (diff) |
rss plugin: try to use <content:encoded> tags in feeds when possible
-rw-r--r-- | data/rbot/plugins/rss.rb | 15 |
1 files changed, 13 insertions, 2 deletions
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 <content:encoded>
+# 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)
|