7 BEGIN { use_ok("IkiWiki"); }
9 %config=IkiWiki::defaultconfig();
10 $config{srcdir}=$config{destdir}="/dev/null";
11 $config{disable_plugins}=["htmlscrubber"];
13 foreach my $multimarkdown (qw(1 0)) {
14 $config{multimarkdown} = $multimarkdown;
15 undef $IkiWiki::Plugin::mdwn::markdown_sub
16 if defined $IkiWiki::Plugin::mdwn::markdown_sub;
17 IkiWiki::loadplugins();
18 IkiWiki::checkconfig();
20 is(IkiWiki::htmlize("foo", "foo", "mdwn",
21 "C. S. Lewis wrote books\n"),
22 "<p>C. S. Lewis wrote books</p>\n",
23 "alphalist off by default for multimarkdown = $multimarkdown");
25 like(IkiWiki::htmlize("foo", "foo", "mdwn",
26 "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
27 qr{<p>This works.*fnref:1.*},
28 "footnotes on by default for multimarkdown = $multimarkdown");
30 $config{mdwn_footnotes} = 0;
31 unlike(IkiWiki::htmlize("foo", "foo", "mdwn",
32 "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"),
33 qr{<p>An unusual link label: .*fnref:1.*},
34 "footnotes can be disabled for multimarkdown = $multimarkdown");
36 $config{mdwn_footnotes} = 1;
37 like(IkiWiki::htmlize("foo", "foo", "mdwn",
38 "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
39 qr{<p>This works.*fnref:1.*},
40 "footnotes can be enabled for multimarkdown = $multimarkdown");
43 $config{mdwn_alpha_lists} = 1;
44 like(IkiWiki::htmlize("foo", "foo", "mdwn",
47 qr{<ol\W}, "alphalist can be enabled");
49 $config{mdwn_alpha_lists} = 0;
50 like(IkiWiki::htmlize("foo", "foo", "mdwn",
53 qr{<p>A. One\sB. Two</p>\n}, "alphalist can be disabled");
56 skip 'set $IKIWIKI_TEST_ASSUME_MODERN_DISCOUNT if you have Discount 2.2.0+', 4
57 unless $ENV{IKIWIKI_TEST_ASSUME_MODERN_DISCOUNT};
58 like(IkiWiki::htmlize("foo", "foo", "mdwn",
59 "Definition list\n: A useful HTML structure\n"),
60 qr{<dl>.*<dt>Definition list</dt>\s*<dd>A useful HTML structure</dd>}s,
61 "definition lists are enabled by default");
62 like(IkiWiki::htmlize("foo", "foo", "mdwn",
63 "```\n#!/bin/sh\n```\n"),
64 qr{<pre>\s*<code>\s*[#]!/bin/sh\s*</code>\s*</pre>}s,
65 "code blocks are enabled by default");
66 like(IkiWiki::htmlize("foo", "foo", "mdwn",
69 "GitHub tag name extensions are enabled by default");
70 like(IkiWiki::htmlize("foo", "foo", "mdwn",
71 "<style>foo</style>"),
72 qr{<style>foo</style>},
73 "Styles are not stripped by default");