summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-09-02 15:31:43 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-09-02 15:31:43 +0200
commita8f5948d947b0502a06fa56db301576a9b694ecb (patch)
tree6966de0d9c7895672f839cdf535a353db7d7dfd9
parent14470d46ea334b1266de97e30b220d3234e17548 (diff)
rss plugin: support atom categories
Atom categories don't have a content attribute, and obviously they don't have an empty? method. Squash them to their label rather than bombing out with error during the blank2nil processing.
-rw-r--r--data/rbot/plugins/rss.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb
index cabc8272..ea8b096c 100644
--- a/data/rbot/plugins/rss.rb
+++ b/data/rbot/plugins/rss.rb
@@ -162,13 +162,14 @@ module ::RSS
end
end
+ # Atom categories are squashed to their label only
{
:link => %w{link.href link},
:guid => %w{guid.content guid},
:content => %w{content.content content},
:description => %w{description.content description},
:title => %w{title.content title},
- :category => %w{category.content category},
+ :category => %w{category.content category.label category},
:dc_subject => %w{dc_subject},
:author => %w{author.name.content author.name author},
:dc_creator => %w{dc_creator}
@@ -177,7 +178,7 @@ module ::RSS
def categories!
return nil unless self.respond_to? :categories
cats = categories.map do |c|
- blank2nil { c.content rescue c rescue nil }
+ blank2nil { c.content rescue c.label rescue c rescue nil }
end.compact
cats.empty? ? nil : cats
end