]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* Support Text::Markdown from CPAN, which has a different interface from
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 16 Sep 2006 01:50:29 +0000 (01:50 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 16 Sep 2006 01:50:29 +0000 (01:50 +0000)
  the original markdown or the one in Debian.

IkiWiki/Plugin/mdwn.pm
debian/changelog
doc/bugs/404_when_cancel_create_page.mdwn
doc/bugs/markdown_module_location.mdwn

index 0fc077f5ec1cc1a30eaffba1ce8d323cccf160cf..c871e2a4d326c7080bdb5803eb462491a6cdbf79 100644 (file)
@@ -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;
        }
        
index 95838fc6ed7fd63a398fa77d52a57cd7a71befd9..62084a6750abbbf6930d43c0c1bcc88c002ef94e 100644 (file)
@@ -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
 
index 780187d31fbf0c5c1d4f43038bdedbf7e3c94b9c..acf5ac9b3f6c13990de015b5abf1d953d68c55f6 100644 (file)
@@ -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
index c42662026df4d5f7fcce28ce7ab47a6494f33986..4deaeb19a0640c0b072f427d111d097eb90ff139 100644 (file)
@@ -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]]