]> sipb.mit.edu Git - ikiwiki.git/commitdiff
mdwn: Add a multimarkdown setup file option.
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 13 May 2008 16:43:25 +0000 (12:43 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 13 May 2008 16:43:25 +0000 (12:43 -0400)
IkiWiki/Plugin/mdwn.pm
debian/changelog
doc/ikiwiki.setup
doc/plugins/mdwn.mdwn
doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn
docwiki.setup

index 2ffe7bc3e6b8cc1656fcba3998cde0e81258fc55..11f3f0137627643fe285e0464b59b2e0086b3f88 100644 (file)
@@ -17,15 +17,19 @@ sub htmlize (@) { #{{{
 
        if (! defined $markdown_sub) {
                # Markdown is forked and splintered upstream and can be
 
        if (! defined $markdown_sub) {
                # Markdown is forked and splintered upstream and can be
-               # available in a variety of incompatible forms. Support
-               # them all.
+               # available in a variety of forms. Support them all.
                no warnings 'once';
                $blosxom::version="is a proper perl module too much to ask?";
                use warnings 'all';
 
                no warnings 'once';
                $blosxom::version="is a proper perl module too much to ask?";
                use warnings 'all';
 
-               eval q{use Markdown};
-               if (! $@) {
-                       $markdown_sub=\&Markdown::Markdown;
+               if (exists $config{multimarkdown} && $config{multimarkdown}) {
+                       eval q{use Text::MultiMarkdown};
+                       if ($@) {
+                               error(gettext("multimarkdown is enabled, but Text::MultiMarkdown is not installed"));
+                       }
+                       $markdown_sub=sub {
+                               Text::MultiMarkdown::markdown(shift, {use_metadata => 0});
+                       }
                }
                else {
                        eval q{use Text::Markdown};
                }
                else {
                        eval q{use Text::Markdown};
@@ -38,11 +42,18 @@ sub htmlize (@) { #{{{
                                }
                        }
                        else {
                                }
                        }
                        else {
-                               do "/usr/bin/markdown" ||
-                                       error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
-                               $markdown_sub=\&Markdown::Markdown;
+                               eval q{use Markdown};
+                               if (! $@) {
+                                       $markdown_sub=\&Markdown::Markdown;
+                               }
+                               else {
+                                       do "/usr/bin/markdown" ||
+                                               error(sprintf(gettext("failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"), $@, $!));
+                                       $markdown_sub=\&Markdown::Markdown;
+                               }
                        }
                }
                        }
                }
+               
                require Encode;
        }
        
                require Encode;
        }
        
index e1f9fbe623d0fe9a64ff9390ae08777c9324c798..ceb113aa14f221910c072d89f0bc67af5d741195 100644 (file)
@@ -1,3 +1,9 @@
+ikiwiki (2.47) UNRELEASED; urgency=low
+
+  * mdwn: Add a multimarkdown setup file option.
+
+ -- Joey Hess <joeyh@debian.org>  Tue, 13 May 2008 12:30:18 -0400
+
 ikiwiki (2.46) unstable; urgency=low
 
   * amazon_s3: New plugin, which injects wiki pages into Amazon S3, allowing
 ikiwiki (2.46) unstable; urgency=low
 
   * amazon_s3: New plugin, which injects wiki pages into Amazon S3, allowing
index e85518849874c313a30e9bacb0cabf6eab7319ae..7813eb822e2ac8788c1bff27343cfca16deff05d 100644 (file)
@@ -133,6 +133,8 @@ use IkiWiki::Setup::Standard {
        # Attempt to make hardlinks to source files instead of copying them.
        # Useful if the wiki contains large media files.
        #hardlink => 1,
        # Attempt to make hardlinks to source files instead of copying them.
        # Useful if the wiki contains large media files.
        #hardlink => 1,
+       # Enable use of multimarkdown features in .mdwn files.
+       #multimarkdown => 1,
 
        # To add plugins, list them here.
        #add_plugins => [qw{goodstuff search wikitext camelcase
 
        # To add plugins, list them here.
        #add_plugins => [qw{goodstuff search wikitext camelcase
index c7c0ac7ce61e0dbe923951d81045203bd75cf46f..07b59c3cf3907435eb216f92aa43732dff3eceb8 100644 (file)
@@ -6,3 +6,15 @@ It uses the [[ikiwiki/markdown]] minimal markup language.
 
 This is the standard markup language used by ikiwiki, although some others
 are also available in other plugins.
 
 This is the standard markup language used by ikiwiki, although some others
 are also available in other plugins.
+
+There are several implementations of markdown support that can be used by
+this plugin. The [original version of
+markdown](http://daringfireball.net/projects/markdown/) can be used, or the
+[[cpan Text::Markdown]] perl module.
+
+[[cpan Text::Markdown]] also includes a markdown varient called
+[multimarkdown](http://fletcherpenney.net/MultiMarkdown/), which supports
+tables, footnotes, and other new features. Multimarkdown is not enabled by
+default, but can be turned on via the `multimarkdown` option in the setup
+file. Note that multimarkdown's metadata and wikilinks features are
+disabled when it's used with ikiwiki.
index 732de0bdf63eb9ea658286342aeebb18dba8a72f..2d22de2c0737794e1e7eb97f5c560d48fbe0efbb 100644 (file)
@@ -30,3 +30,6 @@ MultiMarkdown would solve the BibTex request and the multiple output formats wou
 > Unless there's a way to disable a zillion of the features, please **no**. Do _not_ switch to it. One thing that I like about markdown as opposed to most other ASCII markup languages, is that it has at least a bit of moderation on the syntax (although it could be even simpler). There's not a yet another reserved character lurking behind every corner. Not so in multimarkdown anymore. Footnotes, bibliography and internal references I could use, and they do not add any complex syntax: it's all inside the already reserved sequences of bracketed stuff. (If you can even say that ASCII markup languages have reserved sequences, as they randomly decide to interpret stuff, never actually failing on illegal input, like a proper language to write any serious documentation in, would do.) But tables, math, and so on, no thanks! Too much syntax! Syntax overload! Bzzzt! I don't want mischievous syntaxes lurking behind every corner, out to get me. --[[tuomov]]
 
 > ikiwiki already supports MultiMarkdown, since it has the same API as MarkDown. So if you install it as Markdown.pm (or as /usr/bin/markdown), it should Just Work. It would also be easy to support some other extension such as mmdwn to use multimarkdown installed as MuliMarkdown.pm, if someone wanted to do that for some reason -- just copy the mdwn plugin and lightly modify. --[[Joey]]
 > Unless there's a way to disable a zillion of the features, please **no**. Do _not_ switch to it. One thing that I like about markdown as opposed to most other ASCII markup languages, is that it has at least a bit of moderation on the syntax (although it could be even simpler). There's not a yet another reserved character lurking behind every corner. Not so in multimarkdown anymore. Footnotes, bibliography and internal references I could use, and they do not add any complex syntax: it's all inside the already reserved sequences of bracketed stuff. (If you can even say that ASCII markup languages have reserved sequences, as they randomly decide to interpret stuff, never actually failing on illegal input, like a proper language to write any serious documentation in, would do.) But tables, math, and so on, no thanks! Too much syntax! Syntax overload! Bzzzt! I don't want mischievous syntaxes lurking behind every corner, out to get me. --[[tuomov]]
 
 > ikiwiki already supports MultiMarkdown, since it has the same API as MarkDown. So if you install it as Markdown.pm (or as /usr/bin/markdown), it should Just Work. It would also be easy to support some other extension such as mmdwn to use multimarkdown installed as MuliMarkdown.pm, if someone wanted to do that for some reason -- just copy the mdwn plugin and lightly modify. --[[Joey]]
+
+> There's now a multimarkdown setup file option that uses
+> Text::MultiMarkdown for .mdwn files. [[done]] --[[Joey]]
index 0a6a86678e7591f4c3178cbe0e8c5e2236ac3148..64e5e4ac66fc1a63868208cc633880de609e1c01 100644 (file)
@@ -15,5 +15,6 @@ use IkiWiki::Setup::Standard {
        syslog => 0,
        userdir => "users",
        usedirs => 0,
        syslog => 0,
        userdir => "users",
        usedirs => 0,
+       multimarkdown => 1,
        add_plugins => [qw{goodstuff version haiku polygen fortune}],
 }
        add_plugins => [qw{goodstuff version haiku polygen fortune}],
 }