]> git.deb.at Git - pkg/blosxom.git/blob - blosxom.cgi
Avoid "conditional and" for running plugins "head"
[pkg/blosxom.git] / blosxom.cgi
1 #!/usr/bin/perl
2
3 # Blosxom
4 # Author: Rael Dornfest <rael@oreilly.com>
5 # Version: 2.0.2
6 # Home/Docs/Licensing: http://blosxom.sourceforge.net/
7 # Development/Downloads: http://sourceforge.net/projects/blosxom
8
9 package blosxom;
10
11 # --- Configurable variables -----
12
13 # What's this blog's title?
14 $blog_title = "My Weblog";
15
16 # What's this blog's description (for outgoing RSS feed)?
17 $blog_description = "Yet another Blosxom weblog.";
18
19 # What's this blog's primary language (for outgoing RSS feed)?
20 $blog_language = "en";
21
22 # What's this blog's text encoding ?
23 $blog_encoding = "UTF-8";
24
25 # Where are this blog's entries kept?
26 $datadir = "/Library/WebServer/Documents/blosxom";
27
28 # What's my preferred base URL for this blog (leave blank for automatic)?
29 $url = "";
30
31 # Should I stick only to the datadir for items or travel down the
32 # directory hierarchy looking for items?  If so, to what depth?
33 # 0 = infinite depth (aka grab everything), 1 = datadir only, n = n levels down
34 $depth = 0;
35
36 # How many entries should I show on the home page?
37 $num_entries = 40;
38
39 # What file extension signifies a blosxom entry?
40 $file_extension = "txt";
41
42 # What is the default flavour?
43 $default_flavour = "html";
44
45 # Should I show entries from the future (i.e. dated after now)?
46 $show_future_entries = 0;
47
48 # --- Plugins (Optional) -----
49
50 # File listing plugins blosxom should load 
51 # (if empty blosxom will load all plugins in $plugin_path directories)
52 $plugin_list = "";
53
54 # Where are my plugins kept? 
55 # List of directories, separated by ';' on windows, ':' everywhere else
56 $plugin_path = "";
57
58 # Where should my plugins keep their state information?
59 $plugin_state_dir = "";
60 #$plugin_state_dir = "/var/lib/blosxom/state";
61
62 # --- Static Rendering -----
63
64 # Where are this blog's static files to be created?
65 $static_dir = "/Library/WebServer/Documents/blog";
66
67 # What's my administrative password (you must set this for static rendering)?
68 $static_password = "";
69
70 # What flavours should I generate statically?
71 @static_flavours = qw/html rss/;
72
73 # Should I statically generate individual entries?
74 # 0 = no, 1 = yes
75 $static_entries = 0;
76
77 # --------------------------------
78
79 use vars qw! $version $blog_title $blog_description $blog_language $blog_encoding $datadir $url %template $template $depth $num_entries $file_extension $default_flavour $static_or_dynamic $config_dir $plugin_list $plugin_path $plugin_dir $plugin_state_dir @plugins %plugins $static_dir $static_password @static_flavours $static_entries $path_info $path_info_yr $path_info_mo $path_info_da $path_info_mo_num $flavour $static_or_dynamic %month2num @num2month $interpolate $entries $output $header $show_future_entries %files %indexes %others !;
80
81 use strict;
82 use FileHandle;
83 use File::Find;
84 use File::stat;
85 use Time::localtime;
86 use Time::Local;
87 use CGI qw/:standard :netscape/;
88
89 $version = "2.0.2";
90
91 # Load configuration from $ENV{BLOSXOM_CONFIG_DIR}/blosxom.conf, if it exists
92 my $blosxom_config;
93 if ($ENV{BLOSXOM_CONFIG_FILE} && -r $ENV{BLOSXOM_CONFIG_FILE}) {
94   $blosxom_config = $ENV{BLOSXOM_CONFIG_FILE};
95   ($config_dir = $blosxom_config) =~ s! / [^/]* $ !!x;                          
96 }
97 else {
98   for my $blosxom_config_dir ($ENV{BLOSXOM_CONFIG_DIR}, '/etc/blosxom', '/etc') {
99     if (-r "$blosxom_config_dir/blosxom.conf") {
100       $config_dir = $blosxom_config_dir;
101       $blosxom_config = "$blosxom_config_dir/blosxom.conf";
102       last;
103     }
104   }
105 }
106 # Load $blosxom_config
107 if ($blosxom_config) { 
108   if (-r $blosxom_config) {
109     eval { require $blosxom_config } or
110       warn "Error reading blosxom config file '$blosxom_config'" . ($@ ? ": $@" : '');
111   }
112   else {
113     warn "Cannot find or read blosxom config file '$blosxom_config'";
114   }
115 }
116
117 my $fh = new FileHandle;
118
119 %month2num = (nil=>'00', Jan=>'01', Feb=>'02', Mar=>'03', Apr=>'04', May=>'05', Jun=>'06', Jul=>'07', Aug=>'08', Sep=>'09', Oct=>'10', Nov=>'11', Dec=>'12');
120 @num2month = sort { $month2num{$a} <=> $month2num{$b} } keys %month2num;
121
122 # Use the stated preferred URL or figure it out automatically
123 $url ||= url(-path_info => 1);
124 $url =~ s/^included:/http:/ if $ENV{SERVER_PROTOCOL} eq 'INCLUDED';
125
126 # NOTE: Since v3.12, it looks as if CGI.pm misbehaves for SSIs and
127 # always appends path_info to the url. To fix this, we always
128 # request an url with path_info, and always remove it from the end of the
129 # string.
130 my $pi_len = length $ENV{PATH_INFO};
131 my $might_be_pi = substr($url, -$pi_len);
132 substr($url, -length $ENV{PATH_INFO}) = '' if $might_be_pi eq $ENV{PATH_INFO};
133
134 $url =~ s!/$!!;
135
136 # Drop ending any / from dir settings
137 $datadir =~ s!/$!!; $plugin_dir =~ s!/$!!; $static_dir =~ s!/$!!;
138   
139 # Fix depth to take into account datadir's path
140 $depth += ($datadir =~ tr[/][]) - 1 if $depth;
141
142 # Global variable to be used in head/foot.{flavour} templates
143 $path_info = '';
144
145 $static_or_dynamic = (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and param('-password') eq $static_password) ? 'static' : 'dynamic';
146 $static_or_dynamic eq 'dynamic' and param(-name=>'-quiet', -value=>1);
147
148 # Path Info Magic
149 # Take a gander at HTTP's PATH_INFO for optional blog name, archive yr/mo/day
150 my @path_info = split m{/}, path_info() || param('path'); 
151 shift @path_info;
152
153 while ($path_info[0] and $path_info[0] =~ /^[a-zA-Z].*$/ and $path_info[0] !~ /(.*)\.(.*)/) { $path_info .= '/' . shift @path_info; }
154
155 # Flavour specified by ?flav={flav} or index.{flav}
156 $flavour = '';
157
158 if ( $path_info[$#path_info] =~ /(.+)\.(.+)$/ ) {
159   $flavour = $2;
160   $path_info .= "/$1.$2" if $1 ne 'index';
161   pop @path_info;
162 } else {
163   $flavour = param('flav') || $default_flavour;
164 }
165
166 # Strip spurious slashes
167 $path_info =~ s!(^/*)|(/*$)!!g;
168
169 # Date fiddling
170 ($path_info_yr,$path_info_mo,$path_info_da) = @path_info;
171 $path_info_mo_num = $path_info_mo ? ( $path_info_mo =~ /\d{2}/ ? $path_info_mo : ($month2num{ucfirst(lc $path_info_mo)} || undef) ) : undef;
172
173 # Define standard template subroutine, plugin-overridable at Plugins: Template
174 $template = 
175   sub {
176     my ($path, $chunk, $flavour) = @_;
177
178     do {
179       return join '', <$fh> if $fh->open("< $datadir/$path/$chunk.$flavour");
180     } while ($path =~ s/(\/*[^\/]*)$// and $1);
181
182     # Check for definedness, since flavour can be the empty string
183     if (defined $template{$flavour}{$chunk}) {
184         return $template{$flavour}{$chunk};
185     } elsif (defined $template{error}{$chunk}) {
186         return $template{error}{$chunk} 
187     } else {
188         return '';
189     }
190   };
191 # Bring in the templates
192 %template = ();
193 while (<DATA>) {
194   last if /^(__END__)$/;
195   my($ct, $comp, $txt) = /^(\S+)\s(\S+)(?:\s(.*))?$/ or next;
196   $txt =~ s/\\n/\n/mg;
197   $template{$ct}{$comp} .= $txt . "\n";
198 }
199
200 # Plugins: Start
201 my $path_sep = $^O eq 'MSWin32' ? ';' : ':';
202 my @plugin_dirs = split /$path_sep/, ($plugin_path || $plugin_dir);
203 my @plugin_list = ();
204 my %plugin_hash = ();
205
206 # If $plugin_list is set, read plugins to use from that file
207 $plugin_list = "$config_dir/$plugin_list"
208   if $plugin_list && $plugin_list !~ m!^\s*/!;
209 if ( $plugin_list and -r $plugin_list and $fh->open("< $plugin_list") ) {
210   @plugin_list = map { chomp $_; $_ } grep { /\S/ && ! /^#/ } <$fh>; 
211   $fh->close;
212 }
213 # Otherwise walk @plugin_dirs to get list of plugins to use
214 elsif ( @plugin_dirs ) {
215   for my $plugin_dir ( @plugin_dirs ) {
216     next unless -d $plugin_dir;
217     if ( opendir PLUGINS, $plugin_dir ) {
218       for my $plugin ( grep { /^[\w:]+$/ && ! /~$/ && -f "$plugin_dir/$_" } readdir(PLUGINS) ) {
219         # Ignore duplicates
220         next if $plugin_hash{ $plugin };
221         # Add to @plugin_list and %plugin_hash
222         $plugin_hash{ $plugin } = "$plugin_dir/$plugin";
223         push @plugin_list, $plugin;
224       }
225       closedir PLUGINS;
226     }
227   }
228   @plugin_list = sort @plugin_list;
229 }
230
231 # Load all plugins in @plugin_list
232 unshift @INC, @plugin_dirs;
233 foreach my $plugin ( @plugin_list ) {
234   my($plugin_name, $off) = $plugin =~ /^\d*([\w:]+?)(_?)$/;
235   my $on_off = $off eq '_' ? -1 : 1;
236   # Allow perl module plugins
237   if ($plugin =~ m/::/ && -z $plugin_hash{ $plugin }) {
238     # For Blosxom::Plugin::Foo style plugins, we need to use a string require
239     eval "require $plugin_name";
240   }
241   else {
242     eval { require $plugin };
243   }
244   $@ and warn "$@ error finding or loading blosxom plugin $plugin_name - skipping\n" and next;
245   $plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) and push @plugins, $plugin_name;
246 }
247 shift @INC foreach @plugin_dirs;
248
249 # Plugins: Template
250 # Allow for the first encountered plugin::template subroutine to override the
251 # default built-in template subroutine
252 my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('template') and defined($tmp = $plugin->template()) and $template = $tmp and last; }
253
254 # Provide backward compatibility for Blosxom < 2.0rc1 plug-ins
255 sub load_template {
256   return &$template(@_);
257 }
258
259 # Define default entries subroutine
260 $entries =
261   sub {
262     my(%files, %indexes, %others);
263     find(
264       sub {
265         my $d; 
266         my $curr_depth = $File::Find::dir =~ tr[/][]; 
267         return if $depth and $curr_depth > $depth; 
268      
269         if ( 
270           # a match
271           $File::Find::name =~ m!^$datadir/(?:(.*)/)?(.+)\.$file_extension$!
272           # not an index, .file, and is readable
273           and $2 ne 'index' and $2 !~ /^\./ and (-r $File::Find::name)
274         ) {
275
276             # to show or not to show future entries
277             ( 
278               $show_future_entries
279               or stat($File::Find::name)->mtime < time 
280             )
281
282               # add the file and its associated mtime to the list of files
283               and $files{$File::Find::name} = stat($File::Find::name)->mtime
284
285                 # static rendering bits
286                 and (
287                   param('-all') 
288                   or !-f "$static_dir/$1/index." . $static_flavours[0]
289                   or stat("$static_dir/$1/index." . $static_flavours[0])->mtime < stat($File::Find::name)->mtime
290                 )
291                   and $indexes{$1} = 1
292                     and $d = join('/', (nice_date($files{$File::Find::name}))[5,2,3])
293   
294                       and $indexes{$d} = $d
295                         and $static_entries and $indexes{ ($1 ? "$1/" : '') . "$2.$file_extension" } = 1
296
297             } 
298             else {
299               !-d $File::Find::name and -r $File::Find::name and $others{$File::Find::name} = stat($File::Find::name)->mtime
300             }
301       }, $datadir
302     );
303
304     return (\%files, \%indexes, \%others);
305   };
306
307 # Plugins: Entries
308 # Allow for the first encountered plugin::entries subroutine to override the
309 # default built-in entries subroutine
310 my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('entries') and defined($tmp = $plugin->entries()) and $entries = $tmp and last; }
311
312 my ($files, $indexes, $others) = &$entries();
313 %indexes = %$indexes;
314
315 # Static
316 if (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and param('-password') eq $static_password) {
317
318   param('-quiet') or print "Blosxom is generating static index pages...\n";
319
320   # Home Page and Directory Indexes
321   my %done;
322   foreach my $path ( sort keys %indexes) {
323     my $p = '';
324     foreach ( ('', split /\//, $path) ) {
325       $p .= "/$_";
326       $p =~ s!^/!!;
327       next if $done{$p}++;
328       mkdir "$static_dir/$p", 0755 unless (-d "$static_dir/$p" or $p =~ /\.$file_extension$/);
329       foreach $flavour ( @static_flavours ) {
330         my $content_type = (&$template($p,'content_type',$flavour));
331         $content_type =~ s!\n.*!!s;
332         my $fn = $p =~ m!^(.+)\.$file_extension$! ? $1 : "$p/index";
333         param('-quiet') or print "$fn.$flavour\n";
334         my $fh_w = new FileHandle "> $static_dir/$fn.$flavour" or die "Couldn't open $static_dir/$p for writing: $!";  
335         $output = '';
336         if ($indexes{$path} == 1) {
337           # category
338           $path_info = $p;
339           # individual story
340           $path_info =~ s!\.$file_extension$!\.$flavour!;
341           print $fh_w &generate('static', $path_info, '', $flavour, $content_type);
342         } else {
343           # date
344           local ($path_info_yr,$path_info_mo,$path_info_da, $path_info) = 
345               split /\//, $p, 4;
346           unless (defined $path_info) {$path_info = ""};
347           print $fh_w &generate('static', '', $p, $flavour, $content_type);
348         }
349         $fh_w->close;
350       }
351     }
352   }
353 }
354
355 # Dynamic
356 else {
357   my $content_type = (&$template($path_info,'content_type',$flavour));
358   $content_type =~ s!\n.*!!s;
359
360   $content_type =~ s/(\$\w+(?:::)?\w*)/"defined $1 ? $1 : ''"/gee;
361   $header = {-type=>$content_type};
362
363   print generate('dynamic', $path_info, "$path_info_yr/$path_info_mo_num/$path_info_da", $flavour, $content_type);
364 }
365
366 # Plugins: End
367 foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('end') and $entries = $plugin->end() }
368
369 # Generate 
370 sub generate {
371   my($static_or_dynamic, $currentdir, $date, $flavour, $content_type) = @_;
372
373   %files = %$files; %others = ref $others ? %$others : ();
374
375   # Plugins: Filter
376   foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('filter') and $entries = $plugin->filter(\%files, \%others) }
377
378   my %f = %files;
379
380   # Plugins: Skip
381   # Allow plugins to decide if we can cut short story generation
382   my $skip;
383   foreach my $plugin (@plugins) {
384       if ( $plugins{$plugin} > 0 and $plugin->can('skip') ) {
385           if ( my $tmp = $plugin->skip() ) {
386               $skip = $tmp;
387               last;
388           }
389       }
390   }
391
392   
393   # Define default interpolation subroutine
394   $interpolate = 
395     sub {
396       package blosxom;
397       my $template = shift;
398       $template =~ 
399         s/(\$\w+(?:::)?\w*)/"defined $1 ? $1 : ''"/gee;
400       return $template;
401     };  
402
403   unless (defined($skip) and $skip) {
404
405     # Plugins: Interpolate
406     # Allow for the first encountered plugin::interpolate subroutine to 
407     # override the default built-in interpolate subroutine
408     foreach my $plugin (@plugins) {
409         if ( $plugins{$plugin} > 0 and $plugin->can('interpolate') ) {
410             if ( my $tmp = $plugin->interpolate() ) {
411                 $interpolate = $tmp;
412                 last;
413             }
414         }
415     }
416         
417     # Head
418     my $head = (&$template($currentdir,'head',$flavour));
419   
420     # Plugins: Head
421     foreach my $plugin (@plugins) {
422         if ( $plugins{$plugin} > 0 and $plugin->can('head') ) {
423             $entries = $plugin->head( $currentdir, \$head );
424         }
425     }
426   
427     $head = &$interpolate($head);
428   
429     $output .= $head;
430     
431     # Stories
432     my $curdate = '';
433     my $ne = $num_entries;
434
435     if ( $currentdir =~ /(.*?)([^\/]+)\.(.+)$/ and $2 ne 'index' ) {
436       $currentdir = "$1$2.$file_extension";
437       $files{"$datadir/$1$2.$file_extension"} and %f = ( "$datadir/$1$2.$file_extension" => $files{"$datadir/$1$2.$file_extension"} );
438     } 
439     else { 
440       $currentdir =~ s!/index\..+$!!;
441     }
442
443     # Define a default sort subroutine
444     my $sort = sub {
445       my($files_ref) = @_;
446       return sort { $files_ref->{$b} <=> $files_ref->{$a} } keys %$files_ref;
447     };
448   
449     # Plugins: Sort
450     # Allow for the first encountered plugin::sort subroutine to override the
451     # default built-in sort subroutine
452     my $tmp; foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('sort') and defined($tmp = $plugin->sort()) and $sort = $tmp and last; }
453   
454     foreach my $path_file ( &$sort(\%f, \%others) ) {
455       last if $ne <= 0 && $date !~ /\d/;
456       use vars qw/ $path $fn /;
457       ($path,$fn) = $path_file =~ m!^$datadir/(?:(.*)/)?(.*)\.$file_extension!;
458   
459       # Only stories in the right hierarchy
460       $path =~ /^$currentdir/ or $path_file eq "$datadir/$currentdir" or next;
461   
462       # Prepend a slash for use in templates only if a path exists
463       $path &&= "/$path";
464
465       # Date fiddling for by-{year,month,day} archive views
466       use vars qw/ $dw $mo $mo_num $da $ti $yr $hr $min $hr12 $ampm $utc_offset/;
467       ($dw,$mo,$mo_num,$da,$ti,$yr,$utc_offset) = nice_date($files{"$path_file"});
468       ($hr,$min) = split /:/, $ti;
469       ($hr12, $ampm) = $hr >= 12 ? ($hr - 12,'pm') : ($hr, 'am'); 
470       $hr12 =~ s/^0//; $hr12 == 0 and $hr12 = 12;
471   
472       # Only stories from the right date
473       my($path_info_yr,$path_info_mo_num, $path_info_da) = split /\//, $date;
474       next if $path_info_yr && $yr != $path_info_yr; last if $path_info_yr && $yr < $path_info_yr; 
475       next if $path_info_mo_num && $mo ne $num2month[$path_info_mo_num];
476       next if $path_info_da && $da != $path_info_da; last if $path_info_da && $da < $path_info_da; 
477   
478       # Date 
479       my $date = (&$template($path,'date',$flavour));
480       
481       # Plugins: Date
482       foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('date') and $entries = $plugin->date($currentdir, \$date, $files{$path_file}, $dw,$mo,$mo_num,$da,$ti,$yr) }
483   
484       $date = &$interpolate($date);
485   
486       $curdate ne $date and $curdate = $date and $output .= $date;
487       
488       use vars qw/ $title $body $raw /;
489       if (-f "$path_file" && $fh->open("< $path_file")) {
490         chomp($title = <$fh>);
491         chomp($body = join '', <$fh>);
492         $fh->close;
493         $raw = "$title\n$body";
494       }
495       my $story = (&$template($path,'story',$flavour));
496   
497       # Plugins: Story
498       foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('story') and $entries = $plugin->story($path, $fn, \$story, \$title, \$body) }
499       
500       if ($content_type =~ m{\bxml\b}) {
501         # Escape <, >, and &, and to produce valid RSS
502         my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  
503         my $escape_re  = join '|' => keys %escape;
504         $title =~ s/($escape_re)/$escape{$1}/g;
505         $body =~ s/($escape_re)/$escape{$1}/g;
506       }
507   
508       $story = &$interpolate($story);
509     
510       $output .= $story;
511       $fh->close;
512   
513       $ne--;
514     }
515   
516     # Foot
517     my $foot = (&$template($currentdir,'foot',$flavour));
518   
519     # Plugins: Foot
520     foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('foot') and $entries = $plugin->foot($currentdir, \$foot) }
521   
522     $foot = &$interpolate($foot);
523     $output .= $foot;
524
525     # Plugins: Last
526     foreach my $plugin ( @plugins ) { $plugins{$plugin} > 0 and $plugin->can('last') and $entries = $plugin->last() }
527
528   } # End skip
529
530   # Finally, add the header, if any and running dynamically
531   $static_or_dynamic eq 'dynamic' and $header and $output = header($header) . $output;
532   
533   $output;
534 }
535
536
537 sub nice_date {
538   my($unixtime) = @_;
539   
540   my $c_time = ctime($unixtime);
541   my($dw,$mo,$da,$hr,$min,$yr) = ( $c_time =~ /(\w{3}) +(\w{3}) +(\d{1,2}) +(\d{2}):(\d{2}):\d{2} +(\d{4})$/ );
542   $ti="$hr:$min";
543   $da = sprintf("%02d", $da);
544   my $mo_num = $month2num{$mo};
545
546   my $offset = timegm(00, $min, $hr, $da, $mo_num-1, $yr-1900)-$unixtime;  
547   my $utc_offset = sprintf("%+03d", int($offset / 3600)).sprintf("%02d", ($offset % 3600)/60) ;
548
549   return ($dw,$mo,$mo_num,$da,$ti,$yr,$utc_offset);
550 }
551
552
553 # Default HTML and RSS template bits
554 __DATA__
555 html content_type text/html; charset=$blog_encoding
556
557 html head <html>
558 html head     <head>
559 html head         <meta http-equiv="content-type" content="text/html;charset=$blog_encoding" />
560 html head         <link rel="alternate" type="type="application/rss+xml" title="RSS" href="$url/index.rss" />
561 html head         <title>$blog_title $path_info_da $path_info_mo $path_info_yr
562 html head         </title>
563 html head     </head>
564 html head     <body>
565 html head         <center>
566 html head             <font size="+3">$blog_title</font><br />
567 html head             $path_info_da $path_info_mo $path_info_yr
568 html head         </center>
569 html head         <p />
570
571 html story        <p>
572 html story            <a name="$fn"><b>$title</b></a><br />
573 html story            $body<br />
574 html story            <br />
575 html story            posted at: $ti | path: <a href="$url$path">$path </a> | <a href="$url/$yr/$mo_num/$da#$fn">permanent link to this entry</a>
576 html story        </p>
577
578 html date         <h3>$dw, $da $mo $yr</h3>
579
580 html foot
581 html foot         <p />
582 html foot         <center>
583 html foot             <a href="http://blosxom.sourceforge.net/"><img src="http://blosxom.sourceforge.net/images/pb_blosxom.gif" border="0" /></a>
584 html foot         </center>
585 html foot     </body>
586 html foot </html>
587
588 rss content_type text/xml; charset=$blog_encoding
589
590 rss head <?xml version="1.0" encoding="$blog_encoding"?>
591 rss head <rss version="2.0">
592 rss head   <channel>
593 rss head     <title>$blog_title</title>
594 rss head     <link>$url/$path_info</link>
595 rss head     <description>$blog_description</description>
596 rss head     <language>$blog_language</language>
597 rss head     <docs>http://blogs.law.harvard.edu/tech/rss</docs>
598 rss head     <generator>blosxom/$version</generator>
599
600 rss story   <item>
601 rss story     <title>$title</title>
602 rss story     <pubDate>$dw, $da $mo $yr $ti:00 $utc_offset</pubDate>
603 rss story     <link>$url/$yr/$mo_num/$da#$fn</link>
604 rss story     <category>$path</category>
605 rss story     <guid isPermaLink="false">$path/$fn</guid>
606 rss story     <description>$body</description>
607 rss story   </item>
608
609 rss date 
610
611 rss foot   </channel>
612 rss foot </rss>
613
614 error content_type text/html
615
616 error head <html>
617 error head <body>
618 error head     <p><font color="red">Error: I'm afraid this is the first I've heard of a "$flavour" flavoured Blosxom.  Try dropping the "/+$flavour" bit from the end of the URL.</font></p>
619
620
621 error story <p><b>$title</b><br />
622 error story $body <a href="$url/$yr/$mo_num/$da#fn.$default_flavour">#</a></p>
623
624 error date <h3>$dw, $da $mo $yr</h3>
625
626 error foot     </body>
627 error foot </html>
628 __END__