7 BEGIN { use_ok("IkiWiki"); }
9 %config=IkiWiki::defaultconfig();
10 $config{srcdir}=$config{destdir}="/dev/null";
11 $config{disable_plugins}=["htmlscrubber"];
12 IkiWiki::loadplugins();
13 IkiWiki::checkconfig();
15 is(IkiWiki::htmlize("foo", "foo", "mdwn",
16 "C. S. Lewis wrote books\n"),
17 "<p>C. S. Lewis wrote books</p>\n", "alphalist off by default");
19 $config{mdwn_alpha_lists} = 1;
20 like(IkiWiki::htmlize("foo", "foo", "mdwn",
23 qr{<ol\W}, "alphalist can be enabled");
25 $config{mdwn_alpha_lists} = 0;
26 like(IkiWiki::htmlize("foo", "foo", "mdwn",
29 qr{<p>A. One\sB. Two</p>\n}, "alphalist can be disabled");
31 like(IkiWiki::htmlize("foo", "foo", "mdwn",
32 "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
33 qr{<p>This works<sup\W}, "footnotes on by default");
35 $config{mdwn_footnotes} = 0;
36 like(IkiWiki::htmlize("foo", "foo", "mdwn",
37 "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"),
38 qr{<a href="http://example\.com/">\^1</a>}, "footnotes can be disabled");
40 $config{mdwn_footnotes} = 1;
41 like(IkiWiki::htmlize("foo", "foo", "mdwn",
42 "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"),
43 qr{<p>This works<sup\W}, "footnotes can be enabled");
46 skip 'set $IKIWIKI_TEST_ASSUME_MODERN_DISCOUNT if you have Discount 2.2.0+', 4
47 unless $ENV{IKIWIKI_TEST_ASSUME_MODERN_DISCOUNT};
48 like(IkiWiki::htmlize("foo", "foo", "mdwn",
49 "Definition list\n: A useful HTML structure\n"),
50 qr{<dl>.*<dt>Definition list</dt>\s*<dd>A useful HTML structure</dd>}s,
51 "definition lists are enabled by default");
52 like(IkiWiki::htmlize("foo", "foo", "mdwn",
53 "```\n#!/bin/sh\n```\n"),
54 qr{<pre>\s*<code>\s*[#]!/bin/sh\s*</code>\s*</pre>}s,
55 "code blocks are enabled by default");
56 like(IkiWiki::htmlize("foo", "foo", "mdwn",
59 "GitHub tag name extensions are enabled by default");
60 like(IkiWiki::htmlize("foo", "foo", "mdwn",
61 "<style>foo</style>"),
62 qr{<style>foo</style>},
63 "Styles are not stripped by default");