7 BEGIN { use_ok("IkiWiki"); }
8 BEGIN { use_ok("IkiWiki::Render"); }
10 %config=IkiWiki::defaultconfig();
11 $config{srcdir}=$config{destdir}="/dev/null";
15 $IkiWiki::pagesources{foo} = "foo.mdwn";
16 $IkiWiki::pagemtime{foo} = 42;
17 $IkiWiki::pagectime{foo} = 42;
18 $content = IkiWiki::filter("foo", "foo", $content);
19 $content = IkiWiki::preprocess("foo", "foo", $content);
20 $content = IkiWiki::linkify("foo", "foo", $content);
21 $content = IkiWiki::htmlize("foo", "foo", "mdwn", $content);
22 $content = IkiWiki::genpage("foo", $content);
26 foreach my $scrub (0, 1) {
28 $config{add_plugins}=[qw(color htmlscrubber toc)];
31 $config{add_plugins}=[qw(color toc)];
34 IkiWiki::loadplugins();
35 IkiWiki::checkconfig();
37 like(render('[[!color foreground="fuchsia" background="lime" text="Alert"]]'),
38 qr{(?s)<span class="color" style="color: fuchsia; background-color: lime">Alert</span>});
39 like(render('[[!color foreground="#336699" text="Hello"]]'),
40 qr{(?s)<span class="color" style="color: \#336699">Hello</span>});
41 like(render('[[!color background="#123" text="[Over there](http://localhost/)"]]'),
42 qr{(?s)<span class="color" style="background-color: \#123"><a href="http://localhost/">Over there</a></span>});
43 like(render('[[!color background="censored()" text="Hi"]]'),
44 qr{(?s)<span class="color" style="">Hi</span>});
45 like(render('[[!color foreground="x; pwned: exploit" text="Hi"]]'),
46 qr{(?s)<span class="color" style="">Hi</span>});
48 like(render("[[!toc ]]\n\n## [[!color foreground=red text=Important]]"),
49 qr{<a href="\#index1h2">Important</a>});