Hello; use with Blosxom

Jason Clark jason at jclark.org
Thu Mar 18 16:28:46 EST 2004


On Mar 13, 2004, at 12:32 PM, John Gruber wrote:

> Jason Clark <jason at jclark.org> wrote on 03/13/04 at 12:10a:
>>   * This is running on my blog, but ought to be tested better.  I
>> haven't actually tried uninstalling meta or flipping $blosxom_always 
>> to
>> 1.  I'm going to try and do that tommorow on my localhost Blosxom
>> setup.  I'll also try and get it posted to my blog.
>
> It looks good to me. Thanks a bunch.
>

I've played with these enhancements a bit more.  Everything seems ok, 
except that I changed the meta- tag check to a case-insensetive regex.  
I was having problems with the original `eq` code in one test 
environment.

However, someone noted today that markdown-encoded posts were broken in 
my RSS feed.  The body was okay, but the post titles were showing a "P" 
in the aggregator (NNW or NNW lite, I think).  A quick look showed me 
that because Markdown processes both the story body and the story 
title, the Title was getting wrapped in a <p> tag.

I think this is incorrect behavior.  In blosxom, the story title is 
just another variable, and can be used anywhere within a template.  For 
example, my document head template for single-story view may contain:

<html>
<head>
<title>jclark.org - $blosxom::story</title>
</head>

...to allow me to embed the story title in the document title.  I'm 
guessing this may be an artifact of the original Smartypants blosxom 
interface on which Markdown's blosxom interface is based... it makes 
sense for SP to process the title.  I've disabled the title processing 
in my copy of Markdown.

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

#### 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 = 0;

#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 $meta::markup =~ 
/^\s*markdown\s*$/i)) {
	$$body_ref  = Markdown($$body_ref);
     }
     1;
}

I've also posted this (only the code shown here) on my blog 
(http://jclark.org/weblog/WebDev/Blosxom/Markdownredux.html).

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



More information about the Markdown-discuss mailing list