Update mason_blocks to use Blosxom::Debug.
[matthijs/upstream/blosxom-plugins.git] / gavinc / rss20
1 # Blosxom Plugin: rss20
2 # Author(s): Gavin Carr <gavin@openfusion.com.au>
3 # Version: 0.001000
4 # Requires: lastmodified2
5 # Suggests: absolute
6 # Follows:  lastmodified2
7
8 package rss20;
9
10 use strict;
11 use vars qw(
12   $flavour
13   $author_email 
14   $error_email 
15   $permalink
16   $trackback_link
17   $copyright
18   $generator_url
19 );
20
21 # --- Configuration variables -----
22
23 # What flavour string to you want to use for your feed?
24 $flavour = 'rss';
25 #$flavour = 'rss20';
26
27 # What email address should be used as the default author email?
28 $author_email = 'author@example.com';
29
30 # What email address should feed errors be reported to?
31 $error_email = '';
32
33 # What do your story permalinks look like?
34 # This must be single-quoted, to defer evaluation; blosxom namespace applies
35 $permalink = '$url$path/$fn.$default_flavour';
36
37 # What link should be used for trackbacks on a story?
38 # This must be single-quoted, to defer evaluation; blosxom namespace applies
39 $trackback_link = '';
40 # $trackback_link = '$url$path/$fn.writeback';
41 # $trackback_link = '$url$path/$fn.$feedback::trackback_flavour';
42
43 # Copyright statement; leave blank to omit.
44 $copyright = '';
45
46 # Generator that produced this feed
47 $generator_url = "http://blosxom.sourceforge.net/?v=$blosxom::version";
48
49 # Debug verbosity
50 my $debug_level = 0;
51
52 # --------------------------------
53
54 $error_email ||= $author_email;
55
56 sub start { 
57   _load_templates();
58
59   1;
60 }
61
62 # --- Private subroutines
63
64 sub _load_templates {
65   $blosxom::template{$flavour}{'content_type'} = 'text/xml';
66
67   $blosxom::template{$flavour}{'date'} = "\n";
68
69   $blosxom::template{$flavour}{'head'} = <<'HEAD';
70 <?xml version="1.0" encoding="iso-8859-1"?>
71 <rss version="2.0"
72     xmlns:dc="http://purl.org/dc/elements/1.1/"
73     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
74     xmlns:admin="http://webns.net/mvcb/"
75     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
76     xmlns:content="http://purl.org/rss/1.0/modules/content/">
77
78     <channel>
79         <title>$blog_title</title>
80         <link>$url</link>
81         <description>$blog_description</description>
82         <dc:date>$lastmodified2::latest_iso8601</dc:date>
83         <dc:language>$blosxom::blog_language</dc:language>
84         <dc:creator>mailto:$rss20::author_email</dc:creator>
85         <dc:rights>$rss20::copyright</dc:rights>
86         <admin:generatorAgent rdf:resource="$rss20::generator_url" />
87         <admin:errorReportsTo rdf:resource="mailto:$rss20::error_email" />
88         <sy:updatePeriod>hourly</sy:updatePeriod>
89         <sy:updateFrequency>1</sy:updateFrequency>
90         <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
91
92 HEAD
93
94   $blosxom::template{$flavour}{'story'} = <<STORY;
95         <item>
96             <title>\$title</title>
97             <link>$rss20::permalink</link>                                                                             
98             <description>\$body</description>                                                   
99             <comments>$rss20::trackback_link</comments>                                                            
100             <guid isPermaLink="true">$rss20::permalink</guid>                                                          
101             <dc:date>\$lastmodified2::story_iso8601</dc:date>
102         </item>
103 STORY
104
105   $blosxom::template{$flavour}{'foot'} = <<'FOOT';
106     </channel>                                    
107 </rss>  
108 FOOT
109 }
110
111
112 1;
113
114 __END__
115
116 =head1 NAME
117
118 rss20 - blosxom plugin to generate an RSS 2.0 feed of your blog
119
120 =head1 DESCRIPTION
121
122 rss20 is a blosxom plugin to generate an RSS 2.0 feed of your blog. It
123 is self-contained, including the required flavours, and has a bunch of
124 configuration variables to allow for configuration.
125
126 =head2 CONFIGURATION
127
128 The following package variables can be configured:
129
130 =over 4
131
132 =item $flavour
133
134 Flavour string to use for your feed (typically 'rss' or 'rss20').
135
136 =item $author_email
137
138 Default author email address for posts.
139
140 =item $error_email
141
142 Email address to use to report errors with the feed (defaults to 
143 $author_email).
144
145 =item $permalink
146
147 Story permalink. Default is '$url$path/$fn.$default_flavour'.
148 Note that this value should probably be single quoted to defer
149 variable evaluation until rendering time.
150
151 =item $trackback_link
152
153 Story trackback or comment link. Default is ''. Useful if you
154 are using a comments plugin like C<writeback> or C<feedback>,
155 and the format you want will be plugin-dependant.
156
157 Like $permalink, this value should be single quoted to defer
158 variable evaluation till rendering time.
159
160 =item $copyright
161
162 Default copyright clause for posts, if any.
163
164 =back
165
166 =head1 USAGE
167
168 rss20 should be loaded relatively late, since you'll typically want
169 plugins that manipulate your story content to have run already. It 
170 also should be run after the 'story' or 'prefs' plugins if you want
171 to use those to customise your configuration variables.
172
173
174 =head1 SEE ALSO
175
176 Blosxom: http://blosxom.sourceforge.net/
177
178 rss20 is based on the 'atomfeed' and 'rss10' plugins, by Rael
179 Dornfest and contributors.
180
181
182 =head1 BUGS
183
184 Please report bugs either directly to the author or to the blosxom 
185 development mailing list: <blosxom-devel@lists.sourceforge.net>.
186
187
188 =head1 AUTHOR
189
190 Gavin Carr <gavin@openfusion.com.au>, http://www.openfusion.net/
191
192
193 =head1 LICENSE
194
195 Copyright 2007 Gavin Carr.
196
197 This plugin is licensed under the same terms as blosxom itself i.e.
198
199 Permission is hereby granted, free of charge, to any person obtaining a
200 copy of this software and associated documentation files (the "Software"),
201 to deal in the Software without restriction, including without limitation
202 the rights to use, copy, modify, merge, publish, distribute, sublicense,
203 and/or sell copies of the Software, and to permit persons to whom the
204 Software is furnished to do so, subject to the following conditions:
205
206 The above copyright notice and this permission notice shall be included
207 in all copies or substantial portions of the Software.
208
209 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
210 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
211 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
212 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
213 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
214 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
215 OTHER DEALINGS IN THE SOFTWARE.
216
217 =cut
218
219 # vim:ft=perl