root/platform/tdiary/plugin/makerss_category.rb

Revision 3279, 0.9 kB (checked in by hsbt, 12 months ago)

platform/tdiary/plugin: changed directory rule.

Line 
1#
2# makerss_category.rb: extension for makerss plugin.
3#
4# Copyright (C) 2007 by SHIBATA Hiroshi <h-sbt@nifty.com>
5# Distributed under GPL2.
6#
7# Usage:
8#    @conf['makerss.category'] = ["mixi", "sns"]
9#
10
11class MakeRssCategory < MakeRssFull
12        def title
13                '(category only)'
14        end
15       
16        def item( seq, body, rdfsec )
17                return unless rdfsec.section.respond_to?( :body_to_html )
18                return if rdfsec.section.categories.length == 0
19                rdfsec.section.categories.each do |category|
20                        if @conf['makerss.category'].include?(category)
21                                super
22                        end
23                end
24        end
25       
26        def file
27                f = @conf['makerss.category.file'] || 'category.rdf'
28                f = 'category.rdf' if f.length == 0
29                f
30        end
31       
32        def write( encoder )
33                super( encoder )
34        end
35       
36        def url
37                u = @conf['makerss.category.url'] || "#{@conf.base_url}category.rdf"
38                u = "#{@conf.base_url}category.rdf" if u.length == 0
39                u
40        end
41end
42
43@makerss_rsses << MakeRssCategory::new( @conf )
Note: See TracBrowser for help on using the browser.