]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/mdwn.pm
* Deal with CPAN installing Markdown as Text::Markdown, while it's
[ikiwiki.git] / IkiWiki / Plugin / mdwn.pm
index 8e037f5de192377018cd81c8f12a10c89d76d9bf..0fc077f5ec1cc1a30eaffba1ce8d323cccf160cf 100644 (file)
@@ -7,12 +7,13 @@ use strict;
 use IkiWiki;
 
 sub import { #{{{
-       IkiWiki::hook(type => "htmlize", id => "mdwn", call => \&htmlize);
+       hook(type => "htmlize", id => "mdwn", call => \&htmlize);
 } # }}}
 
 my $markdown_loaded=0;
-sub htmlize ($) { #{{{
-       my $content = shift;
+sub htmlize (@) { #{{{
+       my %params=@_;
+       my $content = $params{content};
 
        if (! $markdown_loaded) {
                # Note: This hack to make markdown run as a proper perl
@@ -24,8 +25,11 @@ sub htmlize ($) { #{{{
 
                eval q{use Markdown};
                if ($@) {
-                       do "/usr/bin/markdown" ||
-                               IkiWiki::error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+                       eval q{use Text::Markdown};
+                       if ($@) {
+                               do "/usr/bin/markdown" ||
+                                       error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+                       }
                }
                $markdown_loaded=1;
                require Encode;