X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/1b4571acd57294e4048e0dc61b1146cf4310913e..684f7d7616fed71e757a9e044f9cc9ee5216d110:/t/mdwn.t diff --git a/t/mdwn.t b/t/mdwn.t index 93b8bd8e9..fc11cadae 100755 --- a/t/mdwn.t +++ b/t/mdwn.t @@ -8,12 +8,37 @@ BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); $config{srcdir}=$config{destdir}="/dev/null"; -IkiWiki::loadplugins(); -IkiWiki::checkconfig(); +$config{disable_plugins}=["htmlscrubber"]; -is(IkiWiki::htmlize("foo", "foo", "mdwn", - "C. S. Lewis wrote books\n"), - "

C. S. Lewis wrote books

\n", "alphalist off by default"); +foreach my $multimarkdown (qw(1 0)) { + $config{multimarkdown} = $multimarkdown; + undef $IkiWiki::Plugin::mdwn::markdown_sub + if defined $IkiWiki::Plugin::mdwn::markdown_sub; + IkiWiki::loadplugins(); + IkiWiki::checkconfig(); + + is(IkiWiki::htmlize("foo", "foo", "mdwn", + "C. S. Lewis wrote books\n"), + "

C. S. Lewis wrote books

\n", + "alphalist off by default for multimarkdown = $multimarkdown"); + + like(IkiWiki::htmlize("foo", "foo", "mdwn", + "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), + qr{

This works.*fnref:1.*}, + "footnotes on by default for multimarkdown = $multimarkdown"); + + $config{mdwn_footnotes} = 0; + unlike(IkiWiki::htmlize("foo", "foo", "mdwn", + "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"), + qr{

An unusual link label: .*fnref:1.*}, + "footnotes can be disabled for multimarkdown = $multimarkdown"); + + $config{mdwn_footnotes} = 1; + like(IkiWiki::htmlize("foo", "foo", "mdwn", + "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), + qr{

This works.*fnref:1.*}, + "footnotes can be enabled for multimarkdown = $multimarkdown"); +} $config{mdwn_alpha_lists} = 1; like(IkiWiki::htmlize("foo", "foo", "mdwn", @@ -27,18 +52,25 @@ like(IkiWiki::htmlize("foo", "foo", "mdwn", "B. Two\n"), qr{

A. One\sB. Two

\n}, "alphalist can be disabled"); -like(IkiWiki::htmlize("foo", "foo", "mdwn", - "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), - qr{

This works\^1}, "footnotes can be disabled"); - -$config{mdwn_footnotes} = 1; -like(IkiWiki::htmlize("foo", "foo", "mdwn", - "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), - qr{

This works.*

Definition list
\s*
A useful HTML structure
}s, + "definition lists are enabled by default"); + like(IkiWiki::htmlize("foo", "foo", "mdwn", + "```\n#!/bin/sh\n```\n"), + qr{
\s*\s*[#]!/bin/sh\s*\s*
}s, + "code blocks are enabled by default"); + like(IkiWiki::htmlize("foo", "foo", "mdwn", + ""), + qr{}, + "GitHub tag name extensions are enabled by default"); + like(IkiWiki::htmlize("foo", "foo", "mdwn", + ""), + qr{}, + "Styles are not stripped by default"); +} done_testing();