Photos
Blog
Projects
vanrenterghem.biz
projects
/
git.ikiwiki.info.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Also seed gitignore with recentchanges
[git.ikiwiki.info.git]
/
IkiWiki
/
Plugin
/
mdwn.pm
diff --git
a/IkiWiki/Plugin/mdwn.pm
b/IkiWiki/Plugin/mdwn.pm
index c871e2a4d326c7080bdb5803eb462491a6cdbf79..2ffe7bc3e6b8cc1656fcba3998cde0e81258fc55 100644
(file)
--- a/
IkiWiki/Plugin/mdwn.pm
+++ b/
IkiWiki/Plugin/mdwn.pm
@@
-4,7
+4,7
@@
package IkiWiki::Plugin::mdwn;
use warnings;
use strict;
use warnings;
use strict;
-use IkiWiki;
+use IkiWiki
2.00
;
sub import { #{{{
hook(type => "htmlize", id => "mdwn", call => \&htmlize);
sub import { #{{{
hook(type => "htmlize", id => "mdwn", call => \&htmlize);
@@
-30,11
+30,16
@@
sub htmlize (@) { #{{{
else {
eval q{use Text::Markdown};
if (! $@) {
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" ||
}
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;
}
}
$markdown_sub=\&Markdown::Markdown;
}
}
@@
-43,9
+48,11
@@
sub htmlize (@) { #{{{
# Workaround for perl bug (#376329)
$content=Encode::encode_utf8($content);
# 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;
$content=Encode::decode_utf8($content);
return $content;