tagging: Allow using titles in for related stories.
[matthijs/upstream/blosxom-plugins.git] / general / atomfeed
index 7721478fcb651a2e9175475a7286e40a2eea896b..c8d36c1da4e3bca8020187131ca09f5196902836 100644 (file)
@@ -4,10 +4,10 @@
 #            UTC and <modified> fixes for 0.3: Frank Hecker
 #            Enclosures support: Dave Slusher and Keith Irwin
 #            Upgrade to Atom 1.0 spec: Sam Pearson
 #            UTC and <modified> fixes for 0.3: Frank Hecker
 #            Enclosures support: Dave Slusher and Keith Irwin
 #            Upgrade to Atom 1.0 spec: Sam Pearson
-# Version: 2005-08-04
+#            Removed static $feed_url, added georss support: Gavin Carr
+# Version: 2007-12-31
 # Docs: Included below: type "perldoc atomfeed", or scroll down
 # Docs: Included below: type "perldoc atomfeed", or scroll down
-# Blosxom Home/Docs/Licensing: http://www.raelity.org/apps/blosxom/
-# Blosxom Plugin Docs: http://www.raelity.org/apps/blosxom/plugin.shtml
+# Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
 
 package atomfeed;
 
 
 package atomfeed;
 
@@ -44,10 +44,6 @@ $copyright = "";
 # Leave blank if you don't understand or for Blosxom to use the domain in $url.
 $id_domain = "";
 
 # Leave blank if you don't understand or for Blosxom to use the domain in $url.
 $id_domain = "";
 
-# Feed url
-# Set the URL of the atom feed here.  Defaults to $blosxom::url/index.atom
-$feed_url = "";
-
 # Icon
 # Put the URL for a site icon here (for example, your site's favicon).  Leave blank to exclude.
 $icon_url = "";
 # Icon
 # Put the URL for a site icon here (for example, your site's favicon).  Leave blank to exclude.
 $icon_url = "";
@@ -60,6 +56,9 @@ $logo_url = "";
 # If you are using the built-in templates, leave this alone.
 my $template_placeholder = "{{{updated}}}";
 
 # If you are using the built-in templates, leave this alone.
 my $template_placeholder = "{{{updated}}}";
 
+# Generator that produced this feed
+$generator_url = "http://blosxom.sourceforge.net/";
+
 # Enclosures support
 # ------------------
 
 # Enclosures support
 # ------------------
 
@@ -85,6 +84,8 @@ $css_type = "text/css";
 
 # ----- END OF CONFIGURABLE VARIABLES -----
 
 
 # ----- END OF CONFIGURABLE VARIABLES -----
 
+# __END_CONFIG__
+
 # --- Plug-in package variables -----
 
 $author = '';
 # --- Plug-in package variables -----
 
 $author = '';
@@ -96,11 +97,11 @@ $zerozero = '00';
 $id_domain or ($id_domain) = $blosxom::url =~ m#http://(?:www\.)?([^\/]+)#;
 
 $utc_date = '';
 $id_domain or ($id_domain) = $blosxom::url =~ m#http://(?:www\.)?([^\/]+)#;
 
 $utc_date = '';
-$feed_utc_date = '';
 use vars qw/$feed_utc_date/;
 $category;
 $links;
 $summary;
 use vars qw/$feed_utc_date/;
 $category;
 $links;
 $summary;
+$georss;
 
 # ----- plugin subroutines -----
 
 
 # ----- plugin subroutines -----
 
@@ -144,8 +145,6 @@ sub head {
 
   $css_url and $css_url = "\n<?xml-stylesheet href=\"$css_url\" type=\"$css_type\"?>";
 
 
   $css_url and $css_url = "\n<?xml-stylesheet href=\"$css_url\" type=\"$css_type\"?>";
 
-  $feed_url or $feed_url = "$blosxom::url/index.atom";
-
   $copyright and $copyright = "<rights>$copyright</rights>";
 
   $author_uri or $author_uri = "$blosxom::url";
   $copyright and $copyright = "<rights>$copyright</rights>";
 
   $author_uri or $author_uri = "$blosxom::url";
@@ -160,6 +159,8 @@ sub head {
   ($blog_title_type, $blog_title) = _parse_markup($blosxom::blog_title);
   ($blog_description_type, $blog_description) = _parse_markup($blosxom::blog_description);
 
   ($blog_title_type, $blog_title) = _parse_markup($blosxom::blog_title);
   ($blog_description_type, $blog_description) = _parse_markup($blosxom::blog_description);
 
+  $feed_utc_date = '';
+
   1;
 }
 
   1;
 }
 
@@ -170,10 +171,17 @@ sub story {
   use File::stat;
 
   # set up <category>:
   use File::stat;
 
   # set up <category>:
+  $category = '';
   if ( $path ) {
     $category = "<category term=\"$path\"/>";
   }
 
   if ( $path ) {
     $category = "<category term=\"$path\"/>";
   }
 
+  # GeoRSS support
+  $georss = '';
+  if ($blosxom::plugins{geo} && $geo::latitude && $geo::longitude) {
+    $georss = qq(<georss:point>$geo::latitude $geo::longitude</georss:point>);
+  }
+
   # <published>: derive from %blosxom::files
   my @published_utc = gmtime($blosxom::files{"$blosxom::datadir$path/$filename.$blosxom::file_extension"});
   $published_utc_date = sprintf("%4d-%02d-%02dT%02d:%02d:00Z",
   # <published>: derive from %blosxom::files
   my @published_utc = gmtime($blosxom::files{"$blosxom::datadir$path/$filename.$blosxom::file_extension"});
   $published_utc_date = sprintf("%4d-%02d-%02dT%02d:%02d:00Z",
@@ -193,7 +201,7 @@ sub story {
                              $updated_utc[1]);
 
   # Date/time of most recently-modified story becomes date/time of the feed.
                              $updated_utc[1]);
 
   # Date/time of most recently-modified story becomes date/time of the feed.
-  $feed_utc_date = $updated_utc_date if $updated_utc_date > $feed_utc_date;
+  $feed_utc_date = $updated_utc_date if $updated_utc_date gt $feed_utc_date;
 
   # use %blosxom::files for the year component of feed-level <atom:id>
   # in case the creation time is cached somewhere.
 
   # use %blosxom::files for the year component of feed-level <atom:id>
   # in case the creation time is cached somewhere.
@@ -260,7 +268,7 @@ sub story {
   # Parse the post body:
   ($body_type, $body) = _parse_markup($$body_ref);
 
   # Parse the post body:
   ($body_type, $body) = _parse_markup($$body_ref);
 
-  1;
+  return 1;
 }
 
 sub foot {
 }
 
 sub foot {
@@ -363,18 +371,28 @@ sub _load_templates {
 
   $blosxom::template{'atom'}{'date'} = "\n";
 
 
   $blosxom::template{'atom'}{'date'} = "\n";
 
-  $blosxom::template{'atom'}{'head'} =<<'HEAD';
-<?xml version="1.0" encoding="utf-8"?>$atomfeed::css_url
-<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://$atomfeed::id_domain">
-  <title type="$atomfeed::blog_title_type">$atomfeed::blog_title</title>
-  <subtitle type="$atomfeed::blog_description_type">$atomfeed::blog_description</subtitle>
-  <link rel="self" type="application/atom+xml" href="$atomfeed::feed_url"/>
+  my $path_info_full = $blosxom::path_info_full || "$blosxom::path_info/index.atom";
+  $blosxom::template{'atom'}{'head'} =<<HEAD;
+<?xml version="1.0" encoding="utf-8"?>\$atomfeed::css_url
+<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://\$atomfeed::id_domain"
+HEAD
+
+  if ($blosxom::plugins{geo}) {
+    $blosxom::template{'atom'}{'head'} .= 
+      qq(      xmlns:georss="http://www.georss.org/georss");
+  }
+
+  $blosxom::template{'atom'}{'head'} .= <<HEAD;
+>
+  <title type="\$atomfeed::blog_title_type">\$atomfeed::blog_title</title>
+  <subtitle type="\$atomfeed::blog_description_type">\$atomfeed::blog_description</subtitle>
+  <link rel="self" type="application/atom+xml" href="$blosxom::url$path_info_full" />
   <link rel="alternate" type="text/html" hreflang="$blosxom::blog_language" href="$blosxom::url" />
   <link rel="alternate" type="text/html" hreflang="$blosxom::blog_language" href="$blosxom::url" />
-  <id>tag$atomfeed::colon$atomfeed::id_domain,$atomfeed::feed_yr$atomfeed::colon/$blosxom::path_info</id>
-  <generator uri="http://www.blosxom.com/" version="$blosxom::version">Blosxom</generator>
-  $atomfeed::copyright
-  $atomfeed::icon_url
-  $atomfeed::logo_url
+  <id>tag\$atomfeed::colon\$atomfeed::id_domain,\$atomfeed::feed_yr\$atomfeed::colon/$blosxom::path_info</id>
+  <generator uri="\$atomfeed::generator_url" version="$blosxom::version">Blosxom</generator>
+  \$atomfeed::copyright
+  \$atomfeed::icon_url
+  \$atomfeed::logo_url
   {{{updated}}}
 HEAD
 
   {{{updated}}}
 HEAD
 
@@ -385,7 +403,7 @@ HEAD
     <title type="$atomfeed::title_type">$atomfeed::title</title>
     <published>$atomfeed::published_utc_date</published>
     <updated>$atomfeed::updated_utc_date</updated>
     <title type="$atomfeed::title_type">$atomfeed::title</title>
     <published>$atomfeed::published_utc_date</published>
     <updated>$atomfeed::updated_utc_date</updated>
-    $atomfeed::category
+    $atomfeed::category$atomfeed::georss
     <author>
       <name>$atomfeed::author</name>
       $atomfeed::author_uri$atomfeed::author_email
     <author>
       <name>$atomfeed::author</name>
       $atomfeed::author_uri$atomfeed::author_email
@@ -417,15 +435,14 @@ Blosxom Plug-in: atomfeed
 Provides an Atom 1.0 feed of your weblog.
 
 The plugin has all you need right on-board, including the appropriate
 Provides an Atom 1.0 feed of your weblog.
 
 The plugin has all you need right on-board, including the appropriate
-flavour template components and a couple-three configuration
-directives.
+flavour template components and a few configuration directives.
 
 
-It supports the majorty of the Atom 1.0 spec exluding the <source>
+It supports the majority of the Atom 1.0 spec excluding the <source>
 element, which seems intended for use in feeds that contain items
 aggregated from other feeds, and currently the <contributor> element,
 which could be included using the meta plugin.
 
 element, which seems intended for use in feeds that contain items
 aggregated from other feeds, and currently the <contributor> element,
 which could be included using the meta plugin.
 
-Point you browser/Atom feed reader at http://yoururl/index.atom.
+Point your browser/feed reader at http://yoururl/index.atom.
 
 =head1 VERSION
 
 
 =head1 VERSION
 
@@ -451,6 +468,9 @@ enclosures plugin originally written by:
 Dave Slusher, http://www.evilgeniuschronicles.org/wordpress/ and Keith
 Irwin,  http://www.asyserver.com/~kirwin/.
 
 Dave Slusher, http://www.evilgeniuschronicles.org/wordpress/ and Keith
 Irwin,  http://www.asyserver.com/~kirwin/.
 
+This plugin is now maintained by the Blosxom Sourceforge Team,
+<blosxom-devel@lists.sourceforge.net>.
+
 =head1 QUICKSTART INSTALLATION
 
 To get an Atom feed up and running in a jiffy, you need only set the
 =head1 QUICKSTART INSTALLATION
 
 To get an Atom feed up and running in a jiffy, you need only set the
@@ -461,7 +481,7 @@ author of each entry.  This can be overidden with the value provided
 by the B<whoami> or B<fauxami> plugins.
 
 B<$feed_yr> is where you specify the year your site began.  This is
 by the B<whoami> or B<fauxami> plugins.
 
 B<$feed_yr> is where you specify the year your site began.  This is
-important  as atomfeed needs to create a unique, unchanging ID for
+important as atomfeed needs to create a unique, unchanging ID for
 your weblog and it need this information to do so.
 
 Everything else is optional.
 your weblog and it need this information to do so.
 
 Everything else is optional.
@@ -515,11 +535,6 @@ individual entries.  By default it'll attempt to glean your domain
 from the specified or calculated value of B<$blosxom::url>, but you can
 override this by setting this variable.
 
 from the specified or calculated value of B<$blosxom::url>, but you can
 override this by setting this variable.
 
-B<$feed_url> Atom feeds contain pointers to themselves, so you can set
-this variable to the location of your atom feed.  If you leave in
-blank, it will use B<$blosxom::url/index.atom>, which in most cases will
-be correct.
-
 B<$icon_url> Set this variable to the URL of an icon to associate with
 your site.  This should be a small image with a 1:1 aspect ratio -
 favicons are ideal.  Leave blank to exclude.
 B<$icon_url> Set this variable to the URL of an icon to associate with
 your site.  This should be a small image with a 1:1 aspect ratio -
 favicons are ideal.  Leave blank to exclude.
@@ -602,10 +617,6 @@ stylesheet, including the required opening and closing tags.  Note
 that this element belongs before the opening <feed> tag, as it is a
 generic XML element.
 
 that this element belongs before the opening <feed> tag, as it is a
 generic XML element.
 
-B<$atomfeed::feed_url> contains the value for the href attribute of a
-feed-level <link rel="self"> element which points back at the feed
-itself.
-
 B<$atomfeed::feed_yr> contains the year your weblog started.
 
 B<$atomfeed::icon_url> contains a complete <icon> element, including
 B<$atomfeed::feed_yr> contains the year your weblog started.
 
 B<$atomfeed::icon_url> contains a complete <icon> element, including
@@ -692,7 +703,7 @@ Where "interpolate_fancy" is the name of the interpolation plugin
 you're turning off _just for the atom feed_.
 
 If you are planning on using the B<config> or B<prefs> plugins to alter
 you're turning off _just for the atom feed_.
 
 If you are planning on using the B<config> or B<prefs> plugins to alter
-varibales in the atomfeed namespace, you will need to ensure that
+variables in the atomfeed namespace, you will need to ensure that
 these plugins run B<before> the atomfeed plugin.  You can do this by
 prefixing a number to the name of the relevant plugin, such as B<1config>
 or B<1prefs>.
 these plugins run B<before> the atomfeed plugin.  You can do this by
 prefixing a number to the name of the relevant plugin, such as B<1config>
 or B<1prefs>.
@@ -705,11 +716,9 @@ browser for it to work as intended.
 
 =head1 SEE ALSO
 
 
 =head1 SEE ALSO
 
-Blosxom Home/Docs/Licensing:
-http://www.raelity.org/apps/blosxom/
+Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/
 
 
-Blosxom Plugin Docs:
-http://www.raelity.org/apps/blosxom/plugin.shtml
+Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
 
 1.0 Update Release Notes:
 http://sgp.me.uk/sam/2005/08/04/atom-for-blosxom
 
 1.0 Update Release Notes:
 http://sgp.me.uk/sam/2005/08/04/atom-for-blosxom
@@ -719,8 +728,8 @@ http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html
 
 =head1 BUGS
 
 
 =head1 BUGS
 
-Address bug reports and comments to the Blosxom mailing list:
-http://www.yahoogroups.com/group/blosxom
+None known; please send bug reports and feedback to the Blosxom
+development mailing list <blosxom-devel@lists.sourceforge.net>.
 
 =head1 LICENSE
 
 
 =head1 LICENSE