summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-05-13 12:43:25 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-05-13 12:43:25 -0400
commitfba4a198b58bdfb33590bda5eaf89bf96ed60099 (patch)
tree433736214267b6d5e4d13b0ca5a07759220ef302
parentd06e4c2c3310dbca56110210bf5b89f538731106 (diff)
mdwn: Add a multimarkdown setup file option.
-rw-r--r--IkiWiki/Plugin/mdwn.pm27
-rw-r--r--debian/changelog6
-rw-r--r--doc/ikiwiki.setup2
-rw-r--r--doc/plugins/mdwn.mdwn12
-rw-r--r--doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn3
-rw-r--r--docwiki.setup1
6 files changed, 43 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm
index 2ffe7bc3e..11f3f0137 100644
--- a/IkiWiki/Plugin/mdwn.pm
+++ b/IkiWiki/Plugin/mdwn.pm
@@ -17,15 +17,19 @@ sub htmlize (@) { #{{{
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';
- 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};
@@ -38,11 +42,18 @@ sub htmlize (@) { #{{{
}
}
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;
}
diff --git a/debian/changelog b/debian/changelog
index e1f9fbe62..ceb113aa1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup
index e85518849..7813eb822 100644
--- a/doc/ikiwiki.setup
+++ b/doc/ikiwiki.setup
@@ -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,
+ # Enable use of multimarkdown features in .mdwn files.
+ #multimarkdown => 1,
# To add plugins, list them here.
#add_plugins => [qw{goodstuff search wikitext camelcase
diff --git a/doc/plugins/mdwn.mdwn b/doc/plugins/mdwn.mdwn
index c7c0ac7ce..07b59c3cf 100644
--- a/doc/plugins/mdwn.mdwn
+++ b/doc/plugins/mdwn.mdwn
@@ -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.
+
+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.
diff --git a/doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn b/doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn
index 732de0bdf..2d22de2c0 100644
--- a/doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn
+++ b/doc/todo/Support__47__Switch_to_MultiMarkdown.mdwn
@@ -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]]
+
+> There's now a multimarkdown setup file option that uses
+> Text::MultiMarkdown for .mdwn files. [[done]] --[[Joey]]
diff --git a/docwiki.setup b/docwiki.setup
index 0a6a86678..64e5e4ac6 100644
--- a/docwiki.setup
+++ b/docwiki.setup
@@ -15,5 +15,6 @@ use IkiWiki::Setup::Standard {
syslog => 0,
userdir => "users",
usedirs => 0,
+ multimarkdown => 1,
add_plugins => [qw{goodstuff version haiku polygen fortune}],
}