Hello; use with Blosxom
Jason Clark
jason at jclark.org
Sat Mar 13 00:10:52 EST 2004
On Mar 12, 2004, at 6:13 PM, John Gruber wrote:
> I might change this to make the Meta-integration the default, but
> I've heard from a few other Blosxom users who are using Markdown and
> who prefer the current defaults.
>
> I think perhaps what I'd like to do is check to see if the Meta
> plug-in is installed, and if so, then use it; if not, then apply
> Markdown to all posts automatically.
>
I had been thinking about this as well; even though meta is very
commonly on Blosxom blogs, I don't like mandatory dependancies; and
having an 'always on' option is a good idea.
Here's my second crack at revamping the Blosxom interface.
#### 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 $meta::markup eq
'markdown')) {
$$title_ref = Markdown($$title_ref);
$$body_ref = Markdown($$body_ref);
}
1;
}
Notes:
* Based on beta1; but then I don't think anything in the Blosxom
interface changed in b2:
* By default, it's still gonna always apply Markdown. I think this
should be the default; even if the Meta plugin is present, we can't
assume the user wants to use it to control Markdown. If you want to
use meta-markup, set $blosxom_always to 0.
* I check for the presence of meta instead of assuming it's avilable.
If blosxom_always is 0, but meta plugin is not available, Markdown will
never be invoked.
* the check for meta occurs in blosxom interface's filter() method.
start() is a poor choice because Markdown could be loaded before meta
(and will be by default, which is alphabetical). filter() will run for
every plugin after all plugins are loaded.
* 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.
Jason Clark <jason at jclark.org>
http://jclark.org/weblog/
More information about the Markdown-discuss
mailing list