From a8f5948d947b0502a06fa56db301576a9b694ecb Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 2 Sep 2010 15:31:43 +0200 Subject: 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. --- data/rbot/plugins/rss.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'data/rbot') 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 -- cgit v1.2.3