web commit by HenrikBrixAndersen: Add patch tag
[ikiwiki.git] / doc / todo / Add_support_for_latest_Text::Markdown_as_found_on_CPAN.mdwn
1 Recent versions of Text::Markdown as found on CPAN (e.g. 1.0.16) no longer contains a Text::Markdown::Markdown() routine, but instead contains a Text::Markdown::markdown() routine (notice the difference in capitalization).
2
3 It seems that the Text::Markdown module as found on CPAN is now identical to Text::MultiMarkdown - hence the subtle change.
4
5 This patch allows IkiWiki to work with either of the two:
6
7     --- IkiWiki/Plugin/mdwn.pm.orig     2008-03-08 11:33:50.000000000 +0100
8     +++ IkiWiki/Plugin/mdwn.pm  2008-03-08 13:37:21.000000000 +0100
9     @@ -28,14 +28,20 @@ sub htmlize (@) { #{{{
10                         $markdown_sub=\&Markdown::Markdown;
11                 }
12                 else {
13     -                   eval q{use Text::Markdown};
14     +                   eval q{use Text::Markdown 'Markdown'};
15                         if (! $@) {
16                                 $markdown_sub=\&Text::Markdown::Markdown;
17                         }
18                         else {
19     -                           do "/usr/bin/markdown" ||
20     -                                   error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
21     -                           $markdown_sub=\&Markdown::Markdown;
22     +                           eval q{use Text::Markdown 'markdown'};
23     +                           if (! $@) {
24     +                                   $markdown_sub=\&Text::Markdown::markdown;
25     +                           }
26     +                           else {
27     +                                   do "/usr/bin/markdown" ||
28     +                                           error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
29     +                                   $markdown_sub=\&Markdown::Markdown;
30     +                           }
31                         }
32                 }
33                 require Encode;
34
35 The above patch, which is against ikiwiki-2.40, should fix [[bugs/markdown_module_location]].
36
37 -- [[HenrikBrixAndersen]]
38
39 [[tag patch]]