Add first-pass rss20 plugin.
authorGavin Carr <gonzai@users.sourceforge.net>
Thu, 13 Sep 2007 10:21:58 +0000 (10:21 +0000)
committerGavin Carr <gonzai@users.sourceforge.net>
Thu, 13 Sep 2007 10:21:58 +0000 (10:21 +0000)
gavinc/rss20 [new file with mode: 0644]

diff --git a/gavinc/rss20 b/gavinc/rss20
new file mode 100644 (file)
index 0000000..6a4e417
--- /dev/null
@@ -0,0 +1,219 @@
+# Blosxom Plugin: rss20
+# Author(s): Gavin Carr <gavin@openfusion.com.au>
+# Version: 0.001000
+# Requires: lastmodified2
+# Suggests: absolute
+# Follows:  lastmodified2
+
+package rss20;
+
+use strict;
+use vars qw(
+  $flavour
+  $author_email 
+  $error_email 
+  $permalink
+  $trackback_link
+  $copyright
+  $generator_url
+);
+
+# --- Configuration variables -----
+
+# What flavour string to you want to use for your feed?
+$flavour = 'rss';
+#$flavour = 'rss20';
+
+# What email address should be used as the default author email?
+$author_email = 'author@example.com';
+
+# What email address should feed errors be reported to?
+$error_email = '';
+
+# What do your story permalinks look like?
+# This must be single-quoted, to defer evaluation; blosxom namespace applies
+$permalink = '$url$path/$fn.$default_flavour';
+
+# What link should be used for trackbacks on a story?
+# This must be single-quoted, to defer evaluation; blosxom namespace applies
+$trackback_link = '';
+# $trackback_link = '$url$path/$fn.writeback';
+# $trackback_link = '$url$path/$fn.$feedback::trackback_flavour';
+
+# Copyright statement; leave blank to omit.
+$copyright = '';
+
+# Generator that produced this feed
+$generator_url = "http://blosxom.sourceforge.net/?v=$blosxom::version";
+
+# Debug verbosity
+my $debug_level = 0;
+
+# --------------------------------
+
+$error_email ||= $author_email;
+
+sub start { 
+  _load_templates();
+
+  1;
+}
+
+# --- Private subroutines
+
+sub _load_templates {
+  $blosxom::template{$flavour}{'content_type'} = 'text/xml';
+
+  $blosxom::template{$flavour}{'date'} = "\n";
+
+  $blosxom::template{$flavour}{'head'} = <<'HEAD';
+<?xml version="1.0" encoding="iso-8859-1"?>
+<rss version="2.0"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+    xmlns:admin="http://webns.net/mvcb/"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:content="http://purl.org/rss/1.0/modules/content/">
+
+    <channel>
+        <title>$blog_title</title>
+        <link>$url</link>
+        <description>$blog_description</description>
+        <dc:date>$lastmodified2::latest_iso8601</dc:date>
+        <dc:language>$blosxom::blog_language</dc:language>
+        <dc:creator>mailto:$rss20::author_email</dc:creator>
+        <dc:rights>$rss20::copyright</dc:rights>
+        <admin:generatorAgent rdf:resource="$rss20::generator_url" />
+        <admin:errorReportsTo rdf:resource="mailto:$rss20::error_email" />
+        <sy:updatePeriod>hourly</sy:updatePeriod>
+        <sy:updateFrequency>1</sy:updateFrequency>
+        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
+
+HEAD
+
+  $blosxom::template{$flavour}{'story'} = <<STORY;
+        <item>
+            <title>\$title</title>
+            <link>$rss20::permalink</link>                                                                             
+            <description>\$body</description>                                                   
+            <comments>$rss20::trackback_link</comments>                                                            
+            <guid isPermaLink="true">$rss20::permalink</guid>                                                          
+            <dc:date>\$lastmodified2::story_iso8601</dc:date>
+        </item>
+STORY
+
+  $blosxom::template{$flavour}{'foot'} = <<'FOOT';
+    </channel>                                    
+</rss>  
+FOOT
+}
+
+
+1;
+
+__END__
+
+=head1 NAME
+
+rss20 - blosxom plugin to generate an RSS 2.0 feed of your blog
+
+=head1 DESCRIPTION
+
+rss20 is a blosxom plugin to generate an RSS 2.0 feed of your blog. It
+is self-contained, including the required flavours, and has a bunch of
+configuration variables to allow for configuration.
+
+=head2 CONFIGURATION
+
+The following package variables can be configured:
+
+=over 4
+
+=item $flavour
+
+Flavour string to use for your feed (typically 'rss' or 'rss20').
+
+=item $author_email
+
+Default author email address for posts.
+
+=item $error_email
+
+Email address to use to report errors with the feed (defaults to 
+$author_email).
+
+=item $permalink
+
+Story permalink. Default is '$url$path/$fn.$default_flavour'.
+Note that this value should probably be single quoted to defer
+variable evaluation until rendering time.
+
+=item $trackback_link
+
+Story trackback or comment link. Default is ''. Useful if you
+are using a comments plugin like C<writeback> or C<feedback>,
+and the format you want will be plugin-dependant.
+
+Like $permalink, this value should be single quoted to defer
+variable evaluation till rendering time.
+
+=item $copyright
+
+Default copyright clause for posts, if any.
+
+=back
+
+=head1 USAGE
+
+rss20 should be loaded relatively late, since you'll typically want
+plugins that manipulate your story content to have run already. It 
+also should be run after the 'story' or 'prefs' plugins if you want
+to use those to customise your configuration variables.
+
+
+=head1 SEE ALSO
+
+Blosxom: http://blosxom.sourceforge.net/
+
+rss20 is based on the 'atomfeed' and 'rss10' plugins, by Rael
+Dornfest and contributors.
+
+
+=head1 BUGS
+
+Please report bugs either directly to the author or to the blosxom 
+development mailing list: <blosxom-devel@lists.sourceforge.net>.
+
+
+=head1 AUTHOR
+
+Gavin Carr <gavin@openfusion.com.au>, http://www.openfusion.net/
+
+
+=head1 LICENSE
+
+Copyright 2007 Gavin Carr.
+
+This plugin is licensed under the same terms as blosxom itself i.e.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+=cut
+
+# vim:ft=perl