]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/mdwn.pm
web commit by http://id.loopysoft.com/matt/: Ignore my stupid choices for paths
[git.ikiwiki.info.git] / IkiWiki / Plugin / mdwn.pm
index c871e2a4d326c7080bdb5803eb462491a6cdbf79..254ab51d03b078afbbeed1727fdb56b18a6c1a1c 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::mdwn;
 
 use warnings;
 use strict;
-use IkiWiki;
+use IkiWiki 2.00;
 
 sub import { #{{{
        hook(type => "htmlize", id => "mdwn", call => \&htmlize);
@@ -34,7 +34,7 @@ sub htmlize (@) { #{{{
                        }
                        else {
                                do "/usr/bin/markdown" ||
-                                       error("failed to load Markdown.pm perl module ($@) or /usr/bin/markdown ($!)");
+                                       error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
                                $markdown_sub=\&Markdown::Markdown;
                        }
                }
@@ -43,9 +43,11 @@ sub htmlize (@) { #{{{
        
        # Workaround for perl bug (#376329)
        $content=Encode::encode_utf8($content);
-       $content=Encode::encode_utf8($content);
-       $content=Markdown::Markdown($content);
-       $content=Encode::decode_utf8($content);
+       eval {$content=&$markdown_sub($content)};
+       if ($@) {
+               eval {$content=&$markdown_sub($content)};
+               print STDERR $@ if $@;
+       }
        $content=Encode::decode_utf8($content);
 
        return $content;