:dc_creator => %w{dc_creator}
}.each { |name, chain| def_bang name, chain }
+ def categories!
+ return nil unless self.respond_to? :categories
+ cats = categories.map do |c|
+ blank2nil { c.content rescue c rescue nil }
+ end.compact
+ cats.empty? ? nil : cats
+ end
+
protected
def blank2nil(&block)
x = yield
# Define default output filters (rss types), and load custom ones.
# Custom filters are looked for in the plugin's default filter locations
- # and in rss/types under botclass.
+ # and in rss/types.rb under botclass.
# Preferably, the rss_type method should be used in these files, e.g.:
# rss_type :my_type do |s|
# line1 = "%{handle} and some %{author} info"
link = item.link!
link.strip! if link
+ categories = item.categories!
category = item.category! || item.dc_subject!
category.strip! if category
author = item.dc_creator! || item.author!
stream_hash = {
:item => item,
:handle => handle,
- :handle_wrap => '::',
+ :handle_wrap => ['::', ':: '],
:date => date,
:date_wrap => [nil, ' :: '],
:title => title,
:title_wrap => Bold,
:desc => desc, :link => link,
+ :categories => categories,
:category => category, :author => author, :at => at
}
output = @bot.filter(key, stream_hash)