2010-04-30
OPML nach XHTML: funktioniert
Ich habe mich nochmals hinter das Problem der nicht funktionierenden XSL-Transformation meiner OPML-Datei geklemmt und tatsächlich herausgefunden, woran es lag. Es fehlte der Standard-Namespace, der die generierte Datei als XHTML deklariert hätte. Mit diesem neuen Vorspann in opml.xsl geht es:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" > <xsl:output method="xml" indent="yes" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" doctype-public="-//W3C//DTD XHTML 1.1//EN" />
Weitere “Kleinigkeiten”, die mir aufgefallen sind:
- IE6 wendet ein per
<xml-stylesheet>-processing instruction eingebundenes CSS-Stylesheet nicht an (wer hätte das gedacht;-) - Wenn die XSL-output method auf
htmlgesetzt wird, werden processing instructions nur mit > beendet, nicht mit ?>. - Es ist möglich, in XHTML PHP einzubetten, wenn das PHP-Flag
short_open_tagauffalsegesetzt wird. Andernfalls reklamiert PHP bereits bei der XML-Deklaration einen Syntax-Fehler.
15:06 [/software/blog] blogroll_xsl_success Google Trackback
perl-bblog
Dieses Programm kann als Mail-Empfäger einen neuen blosxom-Eintrag posten,
zum Beispiel im .forward-File im eigenen Home-Verzeichnis. Ich
persönlich verwende Postfix als
MTA;
eine Datei namens .forward+bblog mit dem Inhalt
|/home/bb/bin/perl-bblog
in meinem Home-Verzeichnis schreibt jedes Mail an bb+bblog@…
in meinen Blog. Das Subject des Mails wird zum Titel des Eintrags, eine Zeile
der Form Password: secret schützt vor unfreundlichen
Drittparteien.
#!/usr/bin/perl -w
my $BLOG = "/home/bb/bblog";
# Standard input is the mail message. Grab it.
$_ = join '', <STDIN>;
# Get the relevant header lines
my ($passwd, $title) = ('', '');
$passwd = $1 if m/Password: +(.+?)\n/mi;
$title = $1 if m/Subject: +(.+?)\n/mi;
if ($passwd eq 'secret' && $title ne '') {
# Generate a file name from the title, removing strange characters
my $file = $title;
$file =~ tr/a-zA-Z0-9 -/a-za-z0-9__/d;
$file = "$BLOG/$file.txt";
# Find the entry body without the signature
my $body = $1 if m/^(<p>.*)/msi;
$body = $1 if ($body =~ /(.*\n)-- \n.*/ms);
# Create the blog entry
open ITEM, "> $file" or die $@;
print ITEM "$title\n$body";
close ITEM;
chmod 0644, $file;
}
15:06 [/software/blog] perl_bblog Google Trackback
Neues Blog-Tool: blosxom
Etwas habe ich ob all der WLAN-Aufregung ganz vergessen: Nachdem mich Movable Type ausgesperrt hat (Debian hat Perl und libdb4 aktualisiert, und die gängigen Rezepte haben nichts gebracht), habe ich meinen blog auf die Minimalisten-Lösung blosxom umgestellt. Dieses Script umfasst tatsächlich nur ca. 65 Zeilen Perl-Code!
Nach einigen Anpassungen zur Unterstützung eines anständigen Datums-Formats (in so wenig Perl finde sogar ich mich zurecht!) war es dann soweit.
15:06 [/software/blog] blosxom Google Trackback
Meine Patches für blosxom und blagg
Gestern abend habe ich meine Patches für blosxom und blagg an Rael Dornfest geschickt. Hier sind sie für die Nachwelt:
blosxom changes:
* Build the escape map and regexp only once.
* Allow the user to override the blog attributes from the blosxom.conf
file in the blog directory.
* Allow the user to define his own date and time formats. This is done
by changing the content/date and content/time templates.
* Add a save_title variable to be used in the Google search string.
* Make the default templates more accessible: The blog title is a <h1>,
dates are <h2>s, entry titles are <h3>s.
--- blosxom.orig 2002-06-04 04:59:31.000000000 +0200
+++ blosxom 2002-09-05 00:17:09.000000000 +0200
@@ -5,7 +5,7 @@
# Version: 0+4i
# Home/Docs/Licensing: http://www.oreillynet.com/~rael/lang/perl/blosxom/
-# --- Configurable variables -----
+# --- Configurable variables, may be overridden by blosxom.conf file -----
# What's my blog's title?
my $blog_title = 'Blosxom';
@@ -29,6 +29,7 @@
use FileHandle;
use File::stat;
use Time::localtime;
+use POSIX qw(strftime);
use CGI qw/:standard :netscape/;
# Take a gander at HTTP's PATH_INFO for optional blog name, archive yr/mo/day
@@ -53,6 +54,21 @@
$template{$ct}{$comp} = $txt;
}
+# Override blog attributes from a file in the blog directory
+if (-r "$datadir/blosxom.conf") {
+ $fh->open("$datadir/blosxom.conf");
+ foreach (<$fh>) {
+ $blog_title = $1 if m/^title:\s*(.*)/i;
+ $blog_description = $1 if m/^description:\s*(.*)/i;
+ $blog_language = $1 if m/^language:\s*(\w+)/i;
+ $num_entries = $1 if m/^entries:\s*(\d+)/i;
+ }
+ $fh->close;
+}
+
+my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
+my $escape_re = join '|' => keys %escape;
+
# Header
print header($content_type);
my $head = join '', $content_type eq 'text/html' && $fh->open("< $datadir/head.html") ? <$fh> : $template{$content_type}{'head'};
@@ -64,31 +80,34 @@
foreach (
sort { return -M "$datadir/$a" <=> -M "$datadir/$b"; }
grep /.txt$/, $dh->read
- ) {
+) {
last if $num_entries-- <= 0 && !$pi_yr;
my($fn) = ($_ =~ /^(.*)\.txt$/);
# Date fiddling for by-{year,month,day} archive views
- my $mtime = ctime(stat("$datadir/$fn.txt")->mtime);
- my($dw,$mo,$da,$ti,$yr) = ( $mtime =~ /(\w{3}) +(\w{3}) +(\d{1,2}) +(\d{2}:\d{2}):\d{2} +(\d{4})$/ );
+ my @mtime = @{localtime(stat("$datadir/$fn.txt")->mtime)};
+ my($yr,$mo,$da) = ($mtime[5] + 1900, $mtime[4] + 1, $mtime[3]);
next if $pi_yr && $yr != $pi_yr; last if $pi_yr && $yr < $pi_yr;
- next if $pi_mo && $mo ne ucfirst(lc $pi_mo);
+ next if $pi_mo && $mo != $pi_mo;
next if $pi_da && $da != $pi_da; last if $pi_da && $da < $pi_da;
- $content_type eq 'text/html' && $curdate ne "$dw, $da $mo $yr" &&
- print span({-class=>'blosxomDate'}, $curdate = "$dw, $da $mo $yr");
+ my $newdate = strftime($template{'content'}{'date'}, @mtime);
+ my $ti = strftime($template{'content'}{'time'}, @mtime);
+ $content_type eq 'text/html' && $curdate ne $newdate &&
+ print h2({-class=>'blosxomDate'}, $curdate = $newdate) . "\n\n";
# Entry
if (-T "$datadir/$fn.txt" && $fh->open("< $datadir/$fn.txt")) {
chomp(my $title = <$fh>);
+ my $save_title = $title;
+ $save_title =~ s/<.*?>//msg; # remove all tags
+ $save_title = escapeHTML($save_title);
chomp(my $body = join '', <$fh>);
if ($content_type eq 'text/xml') {
# Escape <, >, and &, and to produce valid RSS
- my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
- my $escape_re = join '|' => keys %escape;
$title =~ s/($escape_re)/$escape{$1}/g;
$body =~ s/($escape_re)/$escape{$1}/g;
}
@@ -105,9 +124,11 @@
# Default HTML and RSS template bits
__DATA__
-text/html head <html><head><link rel="alternate" type="type="application/rss+xml" title="RSS" href="$url/xml" /><title>Blosxom</title></head><body><center><font size="+3">$blog_title</font></center><p />
-text/html story <p class="blosxomEntry"><a name="$fn"><span class="blosxomTitle"><b>$title</b></span></a><br /><span class="blosxomBody">$body</span><br /><span class="blosxomTime">Posted at $ti</span> <a href="$url/$yr/$mo/$da#$fn">#</a> <a href="http://www.google.com/search?q=$title">G</a></p>\n
-text/html foot <p /><center><h6>Powered -- for some narrow definition of powered -- by <a href="http://www.oreillynet.com/~rael/lang/perl/blosxom/">Blosxom</a></h6></body></html>
-text/xml head <?xml version="1.0"?>\n<!-- name="generator" content="bloxsom/0+3i" -->\n<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">\n\n<rss version="0.91">\n <channel>\n <title>$blog_title</title>\n <link>$url</link>\n <description>$blog_description</description>\n <language>$blog_language</language>\n
-text/xml story <item>\n <title>$title</title>\n <link>$url/$yr/$mo/$da#$fn</link>\n <description>$body</description>\n </item>\n
-text/xml foot </channel>\n</rss>
+text/html head <html><head><link rel="alternate" type="type=application/rss+xml" title="RSS" href="$url/xml" /><title>Blosxom</title></head><body><h1>$blog_title</h1><p />
+text/html story <div class="blosxomEntry"><a name="$fn"><h3 class="blosxomTitle">$title</h3></a><span class="blosxomBody">$body</span><br /><span class="blosxomTime">Posted at $ti</span> <a href="$url/$yr/$mo/$da#$fn">#</a> <a href="http://www.google.com/search?q=$save_title">G</a></div>\n
+text/html foot <p /><center><h6>Powered -- for some narrow definition of powered -- by <a href="http://www.oreillynet.com/~rael/lang/perl/blosxom/">Blosxom</a></h6></body></html>
+text/xml head <?xml version="1.0"?>\n<!-- name="generator" content="bloxsom/0+4i" -->\n<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">\n\n<rss version="0.91">\n\n<channel>\n<title>$blog_title</title>\n<link>$url</link>\n<description>$blog_description</description>\n<language>$blog_language</language>\n
+text/xml story \n<item>\n <title>$title</title>\n <link>$url/$yr/$mo/$da#$fn</link>\n <description>$body</description>\n</item>\n
+text/xml foot \n</channel>\n\n</rss>
+content date %Y-%m-%d
+content time %H:%M
blagg changes:
* Build the unescape hash and regexp only once.
* Enter ! to blog the rest of this feed in automatic mode.
* De-emphasize the feed separator line.
* Make the parser RSS 0.94-compatible. This version uses the <guid> tag.
* The order of the title, link/guid and description tags is not defined.
Make the parser recognize this. This caught me on Mark Pilgrim's and
Dave Winer's feeds (http://diveintomark.org and http://www.scripting.com).
* Make the entry's title the link to the article, remove the "(link)".
IMO it's more intuitive to click on the title.
This change needs the related $safe_title change in blosxom.
--- blagg.orig 2002-04-30 19:13:22.000000000 +0200
+++ blagg 2002-09-04 21:24:04.000000000 +0200
@@ -38,26 +38,36 @@
# Does this blog specify any RSS feeds to watch?
$fh->open("< $datadir/rss.dat") or exit;
+my %unescape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
+my $unescape_re = join '|' => keys %unescape;
+
+my $yn = param('-mode') eq 'automatic' ? '!!' : '';
+
# Loop through the feeds in the list and aggregate
foreach ( <$fh> ) {
my($f_nick,$f_url,$f_mode) = split;
next unless $f_nick =~ /^\w+$/ && $f_url =~ m#^\w+://# && $f_mode =~ /^(interactive|automatic)$/ && $f_mode eq param('-mode');
$fh->open("$get_prog '$f_url' |") || next;
- print "\n_____${f_url}_______________\n";
+ print "\n*** $f_url\n";
my $rss = join '', <$fh>;
$fh->close;
# Feed's title and link
my($f_title, $f_link) = ($rss =~ m#<title>(.*?)</title>.*?<link>(.*?)</link>#ms);
- # RSS items' title, link, and description
- while ( $rss =~ m{<item(?!s).*?>.*?(?:<title>(.*?)</title>.*?)?(?:<link>(.*?)</link>.*?)?(?:<description>(.*?)</description>.*?)?</item>}mgis ) {
- my($i_title, $i_link, $i_desc, $i_fn) = ($1||'', $2||'', $3||'', undef);
+ # RSS items
+ while ( $rss =~ m{<item(?!s).*?>(.*?)</item(?!s)>}mgis ) {
+
+ # Item's title, link and description
+ my $f_item = $1;
+ $_ = $1;
+ my($i_title, $i_link, $i_desc, $i_fn) = (undef, '', '', undef);
+ $i_title = $1 if $f_item =~ m{<title>(.*?)</title>}mis;
+ $i_link = $2 if $f_item =~ m{<(link|guid.*?)>(.*?)</(link|guid)>}mis;
+ $i_desc = $1 if $f_item =~ m{<description>(.*?)</description>}mis;
# Unescape & < > to produce useful HTML
- my %unescape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
- my $unescape_re = join '|' => keys %unescape;
$i_title && $i_title =~ s/($unescape_re)/$unescape{$1}/g;
$i_desc && $i_desc =~ s/($unescape_re)/$unescape{$1}/g;
@@ -76,23 +86,22 @@
# Skip already-aggregated items (aka filename already exists)
next if -e $i_fn;
- my $item = "$i_title\n$i_desc<br />\n(" . a({-href=>$i_link},'link') . ") [" . a({-href=>$f_link}, $f_title) . "]\n";
- my $yn = '';
- if (param('-mode') eq 'automatic') {
- $yn = 'y';
- } else {
- print qq{\n"$i_title"\n[$i_link]\n$i_desc\n\nDo you want to blog this item? (y|n|q)?};
+ my $item = a({-href=>$i_link}, $i_title) . "\n$i_desc<br />\n[" .
+ a({-href=>$f_link}, $f_title) . "]\n";
+ if ($yn !~ /!/) {
+ print qq{\n"$i_title"\n[$i_link]\n$i_desc\n\nDo you want to blog this item? (y|n|q|!)?};
while (<STDIN>) {
- /^([ynq])$/ and $yn = $1, last;
+ /^([ynq!])$/ and $yn = $1, last;
};
}
$yn eq 'q' && exit;
# Save entry to file (and via plug-in if specified)
- $yn eq 'y' &&
+ $yn =~ /[y!]/ &&
$fh->open("> $i_fn") && print($fh $item) && $fh->close() &&
param('-plugin') &&
blaggplug::post($i_title, $i_link, $i_desc, $f_title, $f_link);
}
+ $yn = '' if $yn ne '!!';
}
# Clean up plugin, if specified.
15:06 [/software/blog] rael_patches Google Trackback
Aber was ist das?
Die BBC-Mannen verwenden tatsächlich anstelle des guten alten Kommas ein «Spacing Cedilla» (¸, sieht so aus: ¸ )! Das sieht nicht nur schrecklich aus, das ist eine Vergewaltigung von ASCII, HTML und Unicode!
15:06 [/software/blog] bbc_rss_2 Google Trackback
BBC RSS-Feed
BBC hat jetzt auch RSS-Feeds! Die «Grossen» begreifen es langsam auch!
15:06 [/software/blog] bbc_rss Google Trackback
Endlich: die Blogroll am rechten Rand!
Endlich habe ich es geschafft, meine Blogroll am rechten Rand zu verewigen. Grundlage ist das OPML-File, das auch von plagg gelesen wird. Mit Hilfe einer XSL-Transformation mache ich aus news.opml ein XHTML-Fragment, das von PHP an der entsprechenden Stelle eingefügt wird.
Dies ist das Transformations-File:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="no" standalone="yes"/>
<xsl:template match="head"/>
<xsl:template match="body">
<ul class="blogroll"><xsl:apply-templates/></ul>
</xsl:template>
<xsl:template match="outline">
<li><xsl:choose>
<xsl:when test='@htmlUrl != ""'>
<a href="{@htmlUrl}"><xsl:value-of select="@text"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@text"/>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test='@type = "rss"'> (<a href="{@xmlUrl}">RSS</a>)</xsl:when>
<xsl:when test='@type = "x-plagg-html"'/>
<xsl:when test='@type = "x-plagg-computed"'/>
<xsl:otherwise>
<ul><xsl:apply-templates/></ul>
</xsl:otherwise>
</xsl:choose></li>
</xsl:template>
</xsl:stylesheet>
Und hier das Makefile, das mir nach Änderungen einen Haufen Schreibarbeit spart: (habe ich eigentlich schon einmal gesagt, dass Programmierer im Grunde genommen alle ziemlich faul sind, wenn es um automatisierbare Abläufe geht? ;-)
blogroll.inc: blogroll.xsl news.opml xmlstarlet tr $^ | sed -e '1,3d' >$@
Dieser CSS-Abschnitt formatiert die Liste schliesslich:
.blogroll {
font-size: x-small;
margin-left: 0;
padding-left: 0;
}
.blogroll ul {
padding-left: 1em;
}
.blogroll li {
list-style-type: none;
}
Ich habe auch bereits versucht, die OPML-Datei direkt als XML-Datei mit einem Stylesheet zu versehen, bin dabei aber nicht ganz ans Ziel gelangt. Das Ergebnis sah immer so aus, wie wenn der Browser nur mein Stylesheet anwendet, nicht aber das default HTML-Stylesheet:

15:06 [/software/blog] blogroll Google Trackback
2007-02-06
UTF-8? UTF-8!
Warnung: In den nächsten Tagen könnte meine Homepage Probleme mit der Darstellung
von Umlauten haben; ich bin dabei, das Filesystem von ISO-8859-1 auf UTF-8 umzustellen.
Bei der Shell ist das bereits geschehen; jetzt ist noch ~/public_html dran…
17:02
[/software/blog]
utf8_ahead
Google
Trackback
Tags:
unicode
utf-8
iso-8859-1
2005-03-16
New blosxom plugin: Technorati tags [Update]
I have updated my Technorati tag plugin. Now, you can define different tag prefixes like Technorati, del.icio.us, or even flickr and select which prefix to use per tag that you enter on your blog post. See the code for examples.
# Blosxom Plugin: tags
# Author(s): Beat Bolli <bbolli@ewanet.ch>
# Version: 2005-03-16
# Documentation:
# Generates a <span> containing links to the tag pages
# of the tags defined by the meta-tags variable.
# The div can be inserted in the story template with $tags::tags.
# Requires the meta plugin.
#
package tags;
# ---- configurable variables ----
# The default tag prefix you'd like to use
$prefix_default = 'http://technorati.com/tag/';
# A hash of other prefixes you use sometimes. Select one of
# these by writing: "meta-tags: del:delicious-tag fli:flickr-tag" etc.
# The part before the colon corresponds to the part to
# the left of the => symbol below.
%prefixes = (
del => 'http://del.icio.us/tag/',
fli => 'http://flickr.com/photos/tags/',
# Add more here
);
# HTML text at the beginning of the tag list
$tag_preamble = "<br />Tags:\n";
# HTML element wrapping the tag list (including $tag_preamble)
$tag_element = 'span';
# CSS class of tag list
$tag_class = 'blosxomTags';
# --------------------------------
$tags = '';
sub start {
1;
}
sub story {
$tags = '';
if ($meta::tags ne '') {
for (split(/ +/, $meta::tags)) {
if (/^(.+?):(.+)$/ && defined $prefixes{$1}) {
$pref = $prefixes{$1};
$_ = $2;
}
else {
$pref = $prefix_default;
}
$tags .= "<a rel=\"tag\" href=\"$pref$_\">$_</a>\n";
}
$tags = "<$tag_element class=\"$tag_class\">$tag_preamble$tags</$tag_element>\n";
}
1;
}
1;
23:38
[/software/blog]
blosxom_tags_plugin_2
Google
Trackback
Tags:
technorati
tags
blosxom
plugin
del.icio.us
folksonomy
flickr
plugin
blosxom
2005-03-13
New blosxom plugin: Technorati tags
I have written a small blosxom plugin that generates Technorati tag links.
It requires the meta plugin.
In order to use the plugin, you need to enter a line containing meta-tags: tag1 tag2 tag3…
in your entry’s header, and to insert the variable $tags::tags at the appropriate place in
your story template.
# Blosxom Plugin: tags
# Author(s): Beat Bolli <bbolli@ewanet.ch>
# Version: 2005-03-12
# Documentation:
# Generates a <span> containing links to the technorati tag pages
# of the tags defined by the meta-tags variable.
# The span can be inserted in the story template with $tags::tags.
# Requires the meta plugin.
#
package tags;
# ---- configurable variables ----
# The URL prefix prepended to each tag link
$url_prefix = 'http://technorati.com/tag/';
# uncomment the next line to generate del.icio.us links
# $url_prefix = 'http://del.icio.us/tag/';
# uncomment the next line to generate Flickr links
# $url_prefix = 'http://flickr.com/photos/tags/';
# The text that is generated at the beginning of the tag list
$tag_prefix = "Tags:\n";
# The HTML element that contains all tags
$tag_element = 'span';
# The CSS class of the above HTML element containing all tags
$tag_class = 'blosxomTags';
# --------------------------------
$tags = '';
sub start {
1;
}
sub story {
$tags = '';
if ($meta::tags ne '') {
foreach (split(/ +/, $meta::tags)) {
$tags .= "<a rel=\"tag\" href=\"$url_prefix$_\">$_</a>\n";
}
$tags = "<$tag_element class=\"$tag_class\">$tag_prefix$tags</$tag_element>\n";
}
1;
}
1;
You can configure the text and URL prefixed to your tags, as well as the generated HTML element and its CSS class.
[Update]: Fixed the flickr URL, wrote a plugin update
01:13
[/software/blog]
blosxom_technorati_tags_plugin
Google
Trackback
Tags:
technorati
tags
blosxom
plugin
del.icio.us
folksonomy
2004-04-20
Mark Pilgrim’s universal feed parser 3.0 beta 22
Today Mark Pilgrim
has released a new beta version of his
Universal Feed Parser.
Unfortunately, this won’t be the last beta, because it crashes on
this O’Reilly feed.
The problem is a <textarea> tag with an empty content model in line 47.
The exception is:
File "/home/bb/projects/python/plagg/Feed.py", line 37, in getFeed
return feedparser.parse(self.uri)
File "/home/bb/src/python/feedparser/feedparser.py", line 1870, in parse
feedparser.feed(data)
File "/home/bb/src/python/feedparser/feedparser.py", line 1111, in feed
sgmllib.SGMLParser.feed(self, data)
File "/usr/lib/python2.3/sgmllib.py", line 95, in feed
self.goahead(0)
File "/usr/lib/python2.3/sgmllib.py", line 134, in goahead
k = self.parse_endtag(i)
File "/usr/lib/python2.3/sgmllib.py", line 293, in parse_endtag
self.finish_endtag(tag)
File "/usr/lib/python2.3/sgmllib.py", line 333, in finish_endtag
self.unknown_endtag(tag)
File "/home/bb/src/python/feedparser/feedparser.py", line 304, in unknown_endtag
method()
File "/home/bb/src/python/feedparser/feedparser.py", line 889, in _end_title
context['textinput']['title'] = value
File "/home/bb/src/python/feedparser/feedparser.py", line 133, in __getitem__
return UserDict.__getitem__(self, key)
File "/usr/lib/python2.3/UserDict.py", line 19, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'textinput'
19:23 [/software/blog] mark_feedparser_v3b22 Google Trackback
2004-04-12
pubDate in blosxom RSS feeds
The default blosxom installation doesn’t provide a blog entry’s
publication date and time. The following blosxom plugin defines the variable
$rfctime::rfctime that can be used in your story.rss file
like this: <pubDate>$rfctime::rfctime</pubDate>.
# Blosxom Plugin: rfctime
# Author(s): Beat Bolli <bbolli@ewanet.ch>
# Version: 2004-04-12
# Documentation: Provides $rfctime::rfctime, the RFC822-formatted entry
# timestamp. Use this in your RSS template to provide the entry's
# publication date like this:
#
# <pubDate>$rfctime::rfctime</pubDate>
#
package rfctime;
# --------------------------------
use POSIX 'strftime';
$rfctime = "";
sub start {
1;
}
sub date {
my ($pkg, $dir, $date_ref, $timestamp, $dw,$mo,$mo_num,$da,$ti,$yr) = @_;
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($timestamp);
$rfctime = strftime("%a, %d %b %Y %H:%M:00 GMT", $sec, $min, $hour, $mday, $mon, $year, $wday);
1;
}
1;
23:59 [/software/blog] blosxom_pubdate Google Trackback
2003-05-01
Mein Blogchalk
Switzerland, Aarberg, , German, English, Male, 36-40, Music, Linux. :)
23:54 [/software/blog] blogchalk Google Trackback
2002-10-30
Mark needs a name for his lists
dive into mark: “I need a name for these lists.” The long-time Byte columnist, Jerry Pournelle, had a section every few months where he’d mention stuff like Mark does in these lists. The section’s header always was “Short Shrift Time”.
2002-08-16
Mark’s RSS locator
dive into mark: Ultra-liberal RSS locator
End of rant. Beginning of solution. rssfinder.py. GPL-licensed. It does all that.
Mark uses list comprehensions in his code, so he’s running Python 2 or
later. Also part of Python 2: the string object functions startswith() and
endswith(), so he could easily (and more understandably [is this correct adverb
usage?]) write if not type.startswith(self.RSSTYPE) instead of
if type[:len(self.RSSTYPE)] != self.RSSTYPE: (class LinkParser,
function getLocalLinks) :-)
Other than that, I had a long time to find out that the main index page generated by Movable Type is itself an RSS feed!