Hello; use with Blosxom

Jason Clark jason at jclark.org
Fri Mar 19 11:39:42 EST 2004


On Mar 18, 2004, at 4:28 PM, Jason Clark wrote:

> Taken together, the latest iteration (and hopefully last) of the 
> blosxom interface is:
>

Spoke too soon.  Someone pointed out on my blog that my code was making 
a subtle assumption that if one uses `meta-markup:` to indicate which 
posts have markdown, then all posts would contain a meta-markup header. 
  Oops.  Here's a correction (added the defined() test in story()).


#### Blosxom plug-in interface 
##########################################

# Change $blosxom_always to 0 to use "meta-markup: markdown" story
# headers to enable Markdown on a per-story basis
my $blosxom_always = 1;

#don't change; auto-detects
my $blosxom_hasmeta;

sub start { 1; }
sub filter {
     $blosxom_hasmeta = defined(%meta::);
     1;
}
sub story {
     my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;

      if ($blosxom_always or
          ($blosxom_hasmeta and
           defined($meta::markup) and
           $meta::markup =~ /^\s*markdown\s*$/i))  {
         $$body_ref  = Markdown($$body_ref);
     }
     1;
}



Jason Clark <jason at jclark.org>
http://jclark.org/weblog/



More information about the Markdown-discuss mailing list