X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom-plugins.git;a=blobdiff_plain;f=general%2Fatomfeed;h=c8d36c1da4e3bca8020187131ca09f5196902836;hp=71b536188dd07d5ca7a0bc2bc7c6117df3828c4d;hb=HEAD;hpb=b421665e74a86ea039e14551dd950396ce6b1f83 diff --git a/general/atomfeed b/general/atomfeed index 71b5361..c8d36c1 100644 --- a/general/atomfeed +++ b/general/atomfeed @@ -4,7 +4,8 @@ # UTC and 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 # Blosxom Home/Docs/Licensing: http://blosxom.sourceforge.net/ @@ -43,10 +44,6 @@ $copyright = ""; # 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 = ""; @@ -87,6 +84,8 @@ $css_type = "text/css"; # ----- END OF CONFIGURABLE VARIABLES ----- +# __END_CONFIG__ + # --- Plug-in package variables ----- $author = ''; @@ -98,11 +97,11 @@ $zerozero = '00'; $id_domain or ($id_domain) = $blosxom::url =~ m#http://(?:www\.)?([^\/]+)#; $utc_date = ''; -$feed_utc_date = ''; use vars qw/$feed_utc_date/; $category; $links; $summary; +$georss; # ----- plugin subroutines ----- @@ -146,8 +145,6 @@ sub head { $css_url and $css_url = "\n"; - $feed_url or $feed_url = "$blosxom::url/index.atom"; - $copyright and $copyright = "$copyright"; $author_uri or $author_uri = "$blosxom::url"; @@ -162,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); + $feed_utc_date = ''; + 1; } @@ -172,10 +171,17 @@ sub story { use File::stat; # set up : + $category = ''; if ( $path ) { $category = ""; } + # GeoRSS support + $georss = ''; + if ($blosxom::plugins{geo} && $geo::latitude && $geo::longitude) { + $georss = qq($geo::latitude $geo::longitude); + } + # : 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", @@ -195,7 +201,7 @@ sub story { $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 # in case the creation time is cached somewhere. @@ -262,7 +268,7 @@ sub story { # Parse the post body: ($body_type, $body) = _parse_markup($$body_ref); - 1; + return 1; } sub foot { @@ -365,18 +371,28 @@ sub _load_templates { $blosxom::template{'atom'}{'date'} = "\n"; - $blosxom::template{'atom'}{'head'} =<<'HEAD'; -$atomfeed::css_url - - $atomfeed::blog_title - $atomfeed::blog_description - + my $path_info_full = $blosxom::path_info_full || "$blosxom::path_info/index.atom"; + $blosxom::template{'atom'}{'head'} =<\$atomfeed::css_url + + \$atomfeed::blog_title + \$atomfeed::blog_description + - tag$atomfeed::colon$atomfeed::id_domain,$atomfeed::feed_yr$atomfeed::colon/$blosxom::path_info - Blosxom - $atomfeed::copyright - $atomfeed::icon_url - $atomfeed::logo_url + tag\$atomfeed::colon\$atomfeed::id_domain,\$atomfeed::feed_yr\$atomfeed::colon/$blosxom::path_info + Blosxom + \$atomfeed::copyright + \$atomfeed::icon_url + \$atomfeed::logo_url {{{updated}}} HEAD @@ -387,7 +403,7 @@ HEAD $atomfeed::title $atomfeed::published_utc_date $atomfeed::updated_utc_date - $atomfeed::category + $atomfeed::category$atomfeed::georss $atomfeed::author $atomfeed::author_uri$atomfeed::author_email @@ -519,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. -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. @@ -606,10 +617,6 @@ stylesheet, including the required opening and closing tags. Note that this element belongs before the opening tag, as it is a generic XML element. -B<$atomfeed::feed_url> contains the value for the href attribute of a -feed-level 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 element, including