* Support Text::Markdown from CPAN, which has a different interface from
the original markdown or the one in Debian.master
parent
2c74603157
commit
0df2ad5dfe
|
@ -10,28 +10,34 @@ sub import { #{{{
|
||||||
hook(type => "htmlize", id => "mdwn", call => \&htmlize);
|
hook(type => "htmlize", id => "mdwn", call => \&htmlize);
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
my $markdown_loaded=0;
|
my $markdown_sub;
|
||||||
sub htmlize (@) { #{{{
|
sub htmlize (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
my $content = $params{content};
|
my $content = $params{content};
|
||||||
|
|
||||||
if (! $markdown_loaded) {
|
if (! defined $markdown_sub) {
|
||||||
# Note: This hack to make markdown run as a proper perl
|
# Markdown is forked and splintered upstream and can be
|
||||||
# module. A proper perl module is available in Debian
|
# available in a variety of incompatible forms. Support
|
||||||
# for markdown, but not upstream yet.
|
# them all.
|
||||||
no warnings 'once';
|
no warnings 'once';
|
||||||
$blosxom::version="is a proper perl module too much to ask?";
|
$blosxom::version="is a proper perl module too much to ask?";
|
||||||
use warnings 'all';
|
use warnings 'all';
|
||||||
|
|
||||||
eval q{use Markdown};
|
eval q{use Markdown};
|
||||||
if ($@) {
|
if (! $@) {
|
||||||
|
$markdown_sub=\&Markdown::Markdown;
|
||||||
|
}
|
||||||
|
else {
|
||||||
eval q{use Text::Markdown};
|
eval q{use Text::Markdown};
|
||||||
if ($@) {
|
if (! $@) {
|
||||||
|
$markdown_sub=\&Text::Markdown::Markdown;
|
||||||
|
}
|
||||||
|
else {
|
||||||
do "/usr/bin/markdown" ||
|
do "/usr/bin/markdown" ||
|
||||||
error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
|
error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
|
||||||
|
$markdown_sub=\&Markdown::Markdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$markdown_loaded=1;
|
|
||||||
require Encode;
|
require Encode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ ikiwiki (1.27) UNRELEASED; urgency=low
|
||||||
* pagetemplate hooks are now also called when generating cgi pages.
|
* 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
|
* Add a favicon plugin, which simply adds a link tag for an icon to each
|
||||||
page (and cgis).
|
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
|
* 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.
|
new page, hit cancel, and need to be redirected to somewhere sane.
|
||||||
* Various documentation improvements by various wiki users.
|
* 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
|
ikiwiki (1.26) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,11 @@ is there aren't going to be many possible extensions. Something like `/(.\w+)+/`
|
||||||
(groups of dot separated alpha-num chars if my perl-foo isn't failing me). You could
|
(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.]
|
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
|
> of the check for $hooks{htmlize}{$type}. This limits it to types
|
||||||
> that have a registered htmlize hook (mdwn, etc), and not whatever random
|
> 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,
|
> 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]]
|
> --[[Joey]]
|
||||||
|
|
||||||
>> Nice, sorry I missed it.
|
>> Nice, sorry I missed it.
|
||||||
|
|
|
@ -24,3 +24,9 @@ doesn't has a Markdown::Markdown. Interesting, I'll have a look at it.
|
||||||
|
|
||||||
> It works if you use Text::Markdown::Markdown, sorry, I forgot to mention that.
|
> It works if you use Text::Markdown::Markdown, sorry, I forgot to mention that.
|
||||||
> --JamesWestby
|
> --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]]
|
||||||
|
|
Loading…
Reference in New Issue