the original markdown or the one in Debian.
hook(type => "htmlize", id => "mdwn", call => \&htmlize);
} # }}}
-my $markdown_loaded=0;
+my $markdown_sub;
sub htmlize (@) { #{{{
my %params=@_;
my $content = $params{content};
- if (! $markdown_loaded) {
- # Note: This hack to make markdown run as a proper perl
- # module. A proper perl module is available in Debian
- # for markdown, but not upstream yet.
+ if (! defined $markdown_sub) {
+ # Markdown is forked and splintered upstream and can be
+ # available in a variety of incompatible forms. Support
+ # them all.
no warnings 'once';
$blosxom::version="is a proper perl module too much to ask?";
use warnings 'all';
eval q{use Markdown};
- if ($@) {
+ if (! $@) {
+ $markdown_sub=\&Markdown::Markdown;
+ }
+ else {
eval q{use Text::Markdown};
- if ($@) {
+ if (! $@) {
+ $markdown_sub=\&Text::Markdown::Markdown;
+ }
+ else {
do "/usr/bin/markdown" ||
error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+ $markdown_sub=\&Markdown::Markdown;
}
}
- $markdown_loaded=1;
require Encode;
}
* pagetemplate hooks are now also called when generating cgi pages.
* Add a favicon plugin, which simply adds a link tag for an icon to each
page (and cgis).
- * Deal with CPAN installing Markdown as Text::Markdown, while it's
- installed as just Markdown by apt.
* Patch from James Westby to deal with the case where you're editing a
new page, hit cancel, and need to be redirected to somewhere sane.
* Various documentation improvements by various wiki users.
+ * Support Text::Markdown from CPAN, which has a different interface from
+ the original markdown or the one in Debian.
- -- Joey Hess <joeyh@debian.org> Fri, 15 Sep 2006 21:20:31 -0400
+ -- Joey Hess <joeyh@debian.org> Fri, 15 Sep 2006 21:49:23 -0400
ikiwiki (1.26) unstable; urgency=low
(groups of dot separated alpha-num chars if my perl-foo isn't failing me). You could
at least exclude `/` and `..`. I'm happy to turn this in to a patch if you agree.]
-> The reason it's safe to use possibly_foolish_untaint here is because
+> The reason it's safe to use `possibly_foolish_untaint` here is because
> of the check for $hooks{htmlize}{$type}. This limits it to types
> that have a registered htmlize hook (mdwn, etc), and not whatever random
> garbage an attacker might try to put in. If it wasn't for that check,
-> using possibly_foolish_untaint there would be _very_ foolish indeed..
+> using `possibly_foolish_untaint` there would be _very_ foolish indeed..
> --[[Joey]]
>> Nice, sorry I missed it.
>> I must say thankyou for creating ikiwiki.
->> The more I look at it, the more I admire what you are doing with it and how you are going about it
\ No newline at end of file
+>> The more I look at it, the more I admire what you are doing with it and how you are going about it
--[[Joey]]
> It works if you use Text::Markdown::Markdown, sorry, I forgot to mention that.
-> --JamesWestby
\ No newline at end of file
+> --JamesWestby
+
+I think what I've committed now will work in all cases. Well, unless there
+are even more forks of markdown out there (the CPAN module is a fork
+apparently...)
+
+[[bugs/done]] --[[Joey]]