#x = %Q{

_ [Test][ああ] 唐辛子鶏

} add_subtitle_proc do |date, index, subtitle| #def test(date, index, subtitle) r = subtitle c = nil x1 = x2 = nil if /\A(.*?)(\[.+?\])(.+?)\z/ =~ r x1 = $1 c = $2 x2 = $3 c.sub!(/\[()(.+?)(<\/a>)\]/) do icon = nil title = nil case $2 when '料理' then icon = 'recipe' ; title = '料理' when '本' then icon = 'book' ; title = '本' when '映画' then icon = 'movie' ; title = '映画' when '音楽' then icon = 'music' ; title = '音楽' when 'コンピュータ' then icon = 'computer' ; title = 'コンピュータ' when 'お知らせ' then icon = 'news' ; title = 'お知らせ' when '旅行' then icon = 'travel' ; title = '旅行' else icon = 'default' ; title = 'その他' end %Q[#{$1}#{title}#{$3}] end r = x1 + c + x2 else r = %Q[#{r}] end r end #p test(nil, nil, x) def my_category_list mains = [ ['料理', 'recipe'], ['本', 'book'], ['音楽', 'music'], ['映画', 'movie'], ['コンピュータ', 'computer'], ['旅行', 'travel'], ['お知らせ', 'news'], ['その他', 'default'], ] r = %Q[
メインカテゴリ
\n] mains.each do |pair| img = %Q[#{pair[0]}] r << %Q[#{img}] end r << %Q[\n
サブカテゴリ
\n] categories = category_list.split(" | \n") r << categories.delete_if {|c| /(料理|本|映画|コンピュータ|お知らせ|その他)<\/a>/ =~ c}.join(" | \n") end