summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-16 01:50:29 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-16 01:50:29 +0000
commit0df2ad5dfe1d896520eceabfe362891f68ed3165 (patch)
treed98d17cc42fa6329f424197d27192675c934087e
parent2c74603157482ee4ed15c650ba5a818a5395c0da (diff)
* Support Text::Markdown from CPAN, which has a different interface from
the original markdown or the one in Debian.
-rw-r--r--IkiWiki/Plugin/mdwn.pm22
-rw-r--r--debian/changelog6
-rw-r--r--doc/bugs/404_when_cancel_create_page.mdwn6
-rw-r--r--doc/bugs/markdown_module_location.mdwn8
4 files changed, 27 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index 0fc077f5e..c871e2a4d 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -10,28 +10,34 @@ sub import { #{{{
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;
}
diff --git a/debian/changelog b/debian/changelog
index 95838fc6e..62084a675 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,13 +36,13 @@ ikiwiki (1.27) UNRELEASED; urgency=low
* 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
diff --git a/doc/bugs/404_when_cancel_create_page.mdwn b/doc/bugs/404_when_cancel_create_page.mdwn
index 780187d31..acf5ac9b3 100644
--- a/doc/bugs/404_when_cancel_create_page.mdwn
+++ b/doc/bugs/404_when_cancel_create_page.mdwn
@@ -48,13 +48,13 @@ 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
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
diff --git a/doc/bugs/markdown_module_location.mdwn b/doc/bugs/markdown_module_location.mdwn
index c42662026..4deaeb19a 100644
--- a/doc/bugs/markdown_module_location.mdwn
+++ b/doc/bugs/markdown_module_location.mdwn
@@ -23,4 +23,10 @@ doesn't has a Markdown::Markdown. Interesting, I'll have a look at 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]]