X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/ee1ad53c4c2710aa7ded61bdc56f3a8cce514f22..862ca19eb1aee87e4ac05e8a5a9b326dd32dfe5d:/IkiWiki/Plugin/mdwn.pm diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index ca8898679..2ffe7bc3e 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -30,7 +30,12 @@ sub htmlize (@) { #{{{ else { eval q{use Text::Markdown}; if (! $@) { - $markdown_sub=\&Text::Markdown::Markdown; + if (Text::Markdown->can('markdown')) { + $markdown_sub=\&Text::Markdown::markdown; + } + else { + $markdown_sub=\&Text::Markdown::Markdown; + } } else { do "/usr/bin/markdown" || @@ -43,9 +48,11 @@ sub htmlize (@) { #{{{ # Workaround for perl bug (#376329) $content=Encode::encode_utf8($content); - $content=Encode::encode_utf8($content); - $content=&$markdown_sub($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;