]> git.deb.at Git - pkg/blosxom.git/blob - blosxom.cgi
Avoid "conditional and" for checking after plugins "start" and stuffing @plugins
[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 if (    !$ENV{GATEWAY_INTERFACE}
146     and param('-password')
147     and $static_password
148     and param('-password') eq $static_password )
149 {
150     $static_or_dynamic = 'static';
151 }
152 else {
153     $static_or_dynamic = 'dynamic';
154     param( -name => '-quiet', -value => 1 );
155 }
156
157 # Path Info Magic
158 # Take a gander at HTTP's PATH_INFO for optional blog name, archive yr/mo/day
159 my @path_info = split m{/}, path_info() || param('path'); 
160 shift @path_info;
161
162 while ($path_info[0] and $path_info[0] =~ /^[a-zA-Z].*$/ and $path_info[0] !~ /(.*)\.(.*)/) { $path_info .= '/' . shift @path_info; }
163
164 # Flavour specified by ?flav={flav} or index.{flav}
165 $flavour = '';
166
167 if ( $path_info[$#path_info] =~ /(.+)\.(.+)$/ ) {
168   $flavour = $2;
169   $path_info .= "/$1.$2" if $1 ne 'index';
170   pop @path_info;
171 } else {
172   $flavour = param('flav') || $default_flavour;
173 }
174
175 # Strip spurious slashes
176 $path_info =~ s!(^/*)|(/*$)!!g;
177
178 # Date fiddling
179 ($path_info_yr,$path_info_mo,$path_info_da) = @path_info;
180 $path_info_mo_num = $path_info_mo ? ( $path_info_mo =~ /\d{2}/ ? $path_info_mo : ($month2num{ucfirst(lc $path_info_mo)} || undef) ) : undef;
181
182 # Define standard template subroutine, plugin-overridable at Plugins: Template
183 $template = 
184   sub {
185     my ($path, $chunk, $flavour) = @_;
186
187     do {
188       return join '', <$fh> if $fh->open("< $datadir/$path/$chunk.$flavour");
189     } while ($path =~ s/(\/*[^\/]*)$// and $1);
190
191     # Check for definedness, since flavour can be the empty string
192     if (defined $template{$flavour}{$chunk}) {
193         return $template{$flavour}{$chunk};
194     } elsif (defined $template{error}{$chunk}) {
195         return $template{error}{$chunk} 
196     } else {
197         return '';
198     }
199   };
200 # Bring in the templates
201 %template = ();
202 while (<DATA>) {
203   last if /^(__END__)$/;
204   my($ct, $comp, $txt) = /^(\S+)\s(\S+)(?:\s(.*))?$/ or next;
205   $txt =~ s/\\n/\n/mg;
206   $template{$ct}{$comp} .= $txt . "\n";
207 }
208
209 # Plugins: Start
210 my $path_sep = $^O eq 'MSWin32' ? ';' : ':';
211 my @plugin_dirs = split /$path_sep/, ($plugin_path || $plugin_dir);
212 my @plugin_list = ();
213 my %plugin_hash = ();
214
215 # If $plugin_list is set, read plugins to use from that file
216 $plugin_list = "$config_dir/$plugin_list"
217   if $plugin_list && $plugin_list !~ m!^\s*/!;
218 if ( $plugin_list and -r $plugin_list and $fh->open("< $plugin_list") ) {
219   @plugin_list = map { chomp $_; $_ } grep { /\S/ && ! /^#/ } <$fh>; 
220   $fh->close;
221 }
222 # Otherwise walk @plugin_dirs to get list of plugins to use
223 elsif ( @plugin_dirs ) {
224   for my $plugin_dir ( @plugin_dirs ) {
225     next unless -d $plugin_dir;
226     if ( opendir PLUGINS, $plugin_dir ) {
227       for my $plugin ( grep { /^[\w:]+$/ && ! /~$/ && -f "$plugin_dir/$_" } readdir(PLUGINS) ) {
228         # Ignore duplicates
229         next if $plugin_hash{ $plugin };
230         # Add to @plugin_list and %plugin_hash
231         $plugin_hash{ $plugin } = "$plugin_dir/$plugin";
232         push @plugin_list, $plugin;
233       }
234       closedir PLUGINS;
235     }
236   }
237   @plugin_list = sort @plugin_list;
238 }
239
240 # Load all plugins in @plugin_list
241 unshift @INC, @plugin_dirs;
242 foreach my $plugin ( @plugin_list ) {
243   my($plugin_name, $off) = $plugin =~ /^\d*([\w:]+?)(_?)$/;
244   my $on_off = $off eq '_' ? -1 : 1;
245   # Allow perl module plugins
246   if ($plugin =~ m/::/ && -z $plugin_hash{ $plugin }) {
247     # For Blosxom::Plugin::Foo style plugins, we need to use a string require
248     eval "require $plugin_name";
249   }
250   else {
251     eval { require $plugin };
252   }
253
254   if ($@) {
255       warn "error finding or loading blosxom plugin '$plugin_name': $@";
256       next;
257   }
258   if ( $plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) ) {
259       push @plugins, $plugin_name;
260   }
261
262 }
263 shift @INC foreach @plugin_dirs;
264
265 # Plugins: Template
266 # Allow for the first encountered plugin::template subroutine to override the
267 # default built-in template subroutine
268 foreach my $plugin (@plugins) {
269     if ( $plugins{$plugin} > 0 and $plugin->can('template') ) {
270         if ( my $tmp = $plugin->template() ) {
271             $template = $tmp;
272             last;
273         }
274     }
275 }
276
277 # Provide backward compatibility for Blosxom < 2.0rc1 plug-ins
278 sub load_template {
279   return &$template(@_);
280 }
281
282 # Define default entries subroutine
283 $entries =
284   sub {
285     my(%files, %indexes, %others);
286     find(
287       sub {
288         my $d; 
289         my $curr_depth = $File::Find::dir =~ tr[/][]; 
290         return if $depth and $curr_depth > $depth; 
291      
292         if ( 
293           # a match
294           $File::Find::name =~ m!^$datadir/(?:(.*)/)?(.+)\.$file_extension$!
295           # not an index, .file, and is readable
296           and $2 ne 'index' and $2 !~ /^\./ and (-r $File::Find::name)
297         ) {
298             # read modification time
299             my $mtime = stat($File::Find::name)->mtime or return;
300
301
302             # to show or not to show future entries
303             return unless ($show_future_entries or $mtime < time);
304
305               # add the file and its associated mtime to the list of files
306             $files{$File::Find::name} = $mtime;
307
308                 # static rendering bits
309             my $static_file = "$static_dir/$1/index." . $static_flavours[0];
310             if (param('-all')
311                 or !-f $static_file
312                 or stat($static_file)->mtime < $mtime)
313              {
314               $indexes{$1} = 1;
315               $d = join('/', (nice_date($mtime))[5,2,3]);
316               $indexes{$d} = $d;
317               $indexes{ ($1 ? "$1/" : '') . "$2.$file_extension" } = 1 if $static_entries;
318               }
319           }
320           # not an entries match
321           elsif (!-d $File::Find::name and -r $File::Find::name)
322           {
323             $others{$File::Find::name} = stat($File::Find::name)->mtime;
324           }
325       }, $datadir
326     );
327
328     return (\%files, \%indexes, \%others);
329   };
330
331 # Plugins: Entries
332 # Allow for the first encountered plugin::entries subroutine to override the
333 # default built-in entries subroutine
334 foreach my $plugin (@plugins) {
335     if ( $plugins{$plugin} > 0 and $plugin->can('entries') ) {
336         if ( my $tmp = $plugin->entries() ) {
337             $entries = $tmp;
338             last;
339         }
340     }
341 }
342
343 my ($files, $indexes, $others) = &$entries();
344 %indexes = %$indexes;
345
346 # Static
347 if (!$ENV{GATEWAY_INTERFACE} and param('-password') and $static_password and param('-password') eq $static_password) {
348
349   param('-quiet') or print "Blosxom is generating static index pages...\n";
350
351   # Home Page and Directory Indexes
352   my %done;
353   foreach my $path ( sort keys %indexes) {
354     my $p = '';
355     foreach ( ('', split /\//, $path) ) {
356       $p .= "/$_";
357       $p =~ s!^/!!;
358       next if $done{$p}++;
359       mkdir "$static_dir/$p", 0755 unless (-d "$static_dir/$p" or $p =~ /\.$file_extension$/);
360       foreach $flavour ( @static_flavours ) {
361         my $content_type = (&$template($p,'content_type',$flavour));
362         $content_type =~ s!\n.*!!s;
363         my $fn = $p =~ m!^(.+)\.$file_extension$! ? $1 : "$p/index";
364         param('-quiet') or print "$fn.$flavour\n";
365         my $fh_w = new FileHandle "> $static_dir/$fn.$flavour" or die "Couldn't open $static_dir/$p for writing: $!";  
366         $output = '';
367         if ($indexes{$path} == 1) {
368           # category
369           $path_info = $p;
370           # individual story
371           $path_info =~ s!\.$file_extension$!\.$flavour!;
372           print $fh_w &generate('static', $path_info, '', $flavour, $content_type);
373         } else {
374           # date
375           local ($path_info_yr,$path_info_mo,$path_info_da, $path_info) = 
376               split /\//, $p, 4;
377           unless (defined $path_info) {$path_info = ""};
378           print $fh_w &generate('static', '', $p, $flavour, $content_type);
379         }
380         $fh_w->close;
381       }
382     }
383   }
384 }
385
386 # Dynamic
387 else {
388   my $content_type = (&$template($path_info,'content_type',$flavour));
389   $content_type =~ s!\n.*!!s;
390
391   $content_type =~ s/(\$\w+(?:::)?\w*)/"defined $1 ? $1 : ''"/gee;
392   $header = {-type=>$content_type};
393
394   print generate('dynamic', $path_info, "$path_info_yr/$path_info_mo_num/$path_info_da", $flavour, $content_type);
395 }
396
397 # Plugins: End
398 foreach my $plugin (@plugins) {
399     if ( $plugins{$plugin} > 0 and $plugin->can('end') ) {
400         $entries = $plugin->end();
401     }
402 }
403
404 # Generate 
405 sub generate {
406   my($static_or_dynamic, $currentdir, $date, $flavour, $content_type) = @_;
407
408   %files = %$files; %others = ref $others ? %$others : ();
409
410   # Plugins: Filter
411   foreach my $plugin ( @plugins ) {
412   if ($plugins{$plugin} > 0 and $plugin->can('filter')){ $entries = $plugin->filter(\%files, \%others); }
413   }
414
415   my %f = %files;
416
417   # Plugins: Skip
418   # Allow plugins to decide if we can cut short story generation
419   my $skip;
420   foreach my $plugin (@plugins) {
421       if ( $plugins{$plugin} > 0 and $plugin->can('skip') ) {
422           if ( my $tmp = $plugin->skip() ) {
423               $skip = $tmp;
424               last;
425           }
426       }
427   }
428
429   
430   # Define default interpolation subroutine
431   $interpolate = 
432     sub {
433       package blosxom;
434       my $template = shift;
435       $template =~ 
436         s/(\$\w+(?:::)?\w*)/"defined $1 ? $1 : ''"/gee;
437       return $template;
438     };  
439
440   unless (defined($skip) and $skip) {
441
442     # Plugins: Interpolate
443     # Allow for the first encountered plugin::interpolate subroutine to 
444     # override the default built-in interpolate subroutine
445     foreach my $plugin (@plugins) {
446         if ( $plugins{$plugin} > 0 and $plugin->can('interpolate') ) {
447             if ( my $tmp = $plugin->interpolate() ) {
448                 $interpolate = $tmp;
449                 last;
450             }
451         }
452     }
453         
454     # Head
455     my $head = (&$template($currentdir,'head',$flavour));
456   
457     # Plugins: Head
458     foreach my $plugin (@plugins) {
459         if ( $plugins{$plugin} > 0 and $plugin->can('head') ) {
460             $entries = $plugin->head( $currentdir, \$head );
461         }
462     }
463   
464     $head = &$interpolate($head);
465   
466     $output .= $head;
467     
468     # Stories
469     my $curdate = '';
470     my $ne = $num_entries;
471
472     if ( $currentdir =~ /(.*?)([^\/]+)\.(.+)$/ and $2 ne 'index' ) {
473       $currentdir = "$1$2.$file_extension";
474       %f = ( "$datadir/$currentdir" => $files{"$datadir/$currentdir"} ) if $files{"$datadir/$currentdir"};
475     } 
476     else { 
477       $currentdir =~ s!/index\..+$!!;
478     }
479
480     # Define a default sort subroutine
481     my $sort = sub {
482       my($files_ref) = @_;
483       return sort { $files_ref->{$b} <=> $files_ref->{$a} } keys %$files_ref;
484     };
485   
486     # Plugins: Sort
487     # Allow for the first encountered plugin::sort subroutine to override the
488     # default built-in sort subroutine
489     foreach my $plugin (@plugins) {
490         if ( $plugins{$plugin} > 0 and $plugin->can('sort') ) {
491             if ( my $tmp = $plugin->sort() ) {
492                 $sort = $tmp;
493                 last;
494             }
495         }
496     }
497   
498     foreach my $path_file ( &$sort(\%f, \%others) ) {
499       last if $ne <= 0 && $date !~ /\d/;
500       use vars qw/ $path $fn /;
501       ($path,$fn) = $path_file =~ m!^$datadir/(?:(.*)/)?(.*)\.$file_extension!;
502   
503       # Only stories in the right hierarchy
504       $path =~ /^$currentdir/ or $path_file eq "$datadir/$currentdir" or next;
505   
506       # Prepend a slash for use in templates only if a path exists
507       $path &&= "/$path";
508
509       # Date fiddling for by-{year,month,day} archive views
510       use vars qw/ $dw $mo $mo_num $da $ti $yr $hr $min $hr12 $ampm $utc_offset/;
511       ($dw,$mo,$mo_num,$da,$ti,$yr,$utc_offset) = nice_date($files{"$path_file"});
512       ($hr,$min) = split /:/, $ti;
513       ($hr12, $ampm) = $hr >= 12 ? ($hr - 12,'pm') : ($hr, 'am'); 
514       $hr12 =~ s/^0//; if ($hr12 == 0) {$hr12 = 12};
515   
516       # Only stories from the right date
517       my($path_info_yr,$path_info_mo_num, $path_info_da) = split /\//, $date;
518       next if $path_info_yr && $yr != $path_info_yr; last if $path_info_yr && $yr < $path_info_yr; 
519       next if $path_info_mo_num && $mo ne $num2month[$path_info_mo_num];
520       next if $path_info_da && $da != $path_info_da; last if $path_info_da && $da < $path_info_da; 
521   
522       # Date 
523       my $date = (&$template($path,'date',$flavour));
524       
525       # Plugins: Date
526       foreach my $plugin (@plugins) {
527           if ( $plugins{$plugin} > 0 and $plugin->can('date') ) {
528               $entries
529                   = $plugin->date( $currentdir, \$date, $files{$path_file}, $dw,
530                   $mo, $mo_num, $da, $ti, $yr );
531           }
532       }
533   
534       $date = &$interpolate($date);
535   
536       if ( $date && $curdate ne $date ) {
537           $curdate = $date;
538           $output .= $date;
539       }
540       
541       use vars qw/ $title $body $raw /;
542       if (-f "$path_file" && $fh->open("< $path_file")) {
543         chomp($title = <$fh>);
544         chomp($body = join '', <$fh>);
545         $fh->close;
546         $raw = "$title\n$body";
547       }
548       my $story = (&$template($path,'story',$flavour));
549   
550       # Plugins: Story
551       foreach my $plugin (@plugins) {
552           if ( $plugins{$plugin} > 0 and $plugin->can('story') ) {
553               $entries = $plugin->story( $path, $fn, \$story, \$title, \$body );
554           }
555       }
556       
557       if ($content_type =~ m{\bxml\b}) {
558         # Escape <, >, and &, and to produce valid RSS
559         my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  
560         my $escape_re  = join '|' => keys %escape;
561         $title =~ s/($escape_re)/$escape{$1}/g;
562         $body =~ s/($escape_re)/$escape{$1}/g;
563       }
564   
565       $story = &$interpolate($story);
566     
567       $output .= $story;
568       $fh->close;
569   
570       $ne--;
571     }
572   
573     # Foot
574     my $foot = (&$template($currentdir,'foot',$flavour));
575   
576     # Plugins: Foot
577     foreach my $plugin (@plugins) {
578         if ( $plugins{$plugin} > 0 and $plugin->can('foot') ) {
579             $entries = $plugin->foot( $currentdir, \$foot );
580         }
581     }
582   
583     $foot = &$interpolate($foot);
584     $output .= $foot;
585
586     # Plugins: Last
587     foreach my $plugin (@plugins) {
588         if ( $plugins{$plugin} > 0 and $plugin->can('last') ) {
589             $entries = $plugin->last();
590         }
591     }
592
593   } # End skip
594
595   # Finally, add the header, if any and running dynamically
596   $output = header($header) . $output if ($static_or_dynamic eq 'dynamic' and $header);
597   
598   $output;
599 }
600
601
602 sub nice_date {
603   my($unixtime) = @_;
604   
605   my $c_time = ctime($unixtime);
606   my($dw,$mo,$da,$hr,$min,$yr) = ( $c_time =~ /(\w{3}) +(\w{3}) +(\d{1,2}) +(\d{2}):(\d{2}):\d{2} +(\d{4})$/ );
607   $ti="$hr:$min";
608   $da = sprintf("%02d", $da);
609   my $mo_num = $month2num{$mo};
610
611   my $offset = timegm(00, $min, $hr, $da, $mo_num-1, $yr-1900)-$unixtime;  
612   my $utc_offset = sprintf("%+03d", int($offset / 3600)).sprintf("%02d", ($offset % 3600)/60) ;
613
614   return ($dw,$mo,$mo_num,$da,$ti,$yr,$utc_offset);
615 }
616
617
618 # Default HTML and RSS template bits
619 __DATA__
620 html content_type text/html; charset=$blog_encoding
621
622 html head <html>
623 html head     <head>
624 html head         <meta http-equiv="content-type" content="text/html;charset=$blog_encoding" />
625 html head         <link rel="alternate" type="type="application/rss+xml" title="RSS" href="$url/index.rss" />
626 html head         <title>$blog_title $path_info_da $path_info_mo $path_info_yr
627 html head         </title>
628 html head     </head>
629 html head     <body>
630 html head         <center>
631 html head             <font size="+3">$blog_title</font><br />
632 html head             $path_info_da $path_info_mo $path_info_yr
633 html head         </center>
634 html head         <p />
635
636 html story        <p>
637 html story            <a name="$fn"><b>$title</b></a><br />
638 html story            $body<br />
639 html story            <br />
640 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>
641 html story        </p>
642
643 html date         <h3>$dw, $da $mo $yr</h3>
644
645 html foot
646 html foot         <p />
647 html foot         <center>
648 html foot             <a href="http://blosxom.sourceforge.net/"><img src="http://blosxom.sourceforge.net/images/pb_blosxom.gif" border="0" /></a>
649 html foot         </center>
650 html foot     </body>
651 html foot </html>
652
653 rss content_type text/xml; charset=$blog_encoding
654
655 rss head <?xml version="1.0" encoding="$blog_encoding"?>
656 rss head <rss version="2.0">
657 rss head   <channel>
658 rss head     <title>$blog_title</title>
659 rss head     <link>$url/$path_info</link>
660 rss head     <description>$blog_description</description>
661 rss head     <language>$blog_language</language>
662 rss head     <docs>http://blogs.law.harvard.edu/tech/rss</docs>
663 rss head     <generator>blosxom/$version</generator>
664
665 rss story   <item>
666 rss story     <title>$title</title>
667 rss story     <pubDate>$dw, $da $mo $yr $ti:00 $utc_offset</pubDate>
668 rss story     <link>$url/$yr/$mo_num/$da#$fn</link>
669 rss story     <category>$path</category>
670 rss story     <guid isPermaLink="false">$path/$fn</guid>
671 rss story     <description>$body</description>
672 rss story   </item>
673
674 rss date 
675
676 rss foot   </channel>
677 rss foot </rss>
678
679 error content_type text/html
680
681 error head <html>
682 error head <body>
683 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>
684
685
686 error story <p><b>$title</b><br />
687 error story $body <a href="$url/$yr/$mo_num/$da#fn.$default_flavour">#</a></p>
688
689 error date <h3>$dw, $da $mo $yr</h3>
690
691 error foot     </body>
692 error foot </html>
693 __END__