7 BEGIN { use_ok("IkiWiki"); }
8 BEGIN { use_ok("IkiWiki::Render"); }
10 %config=IkiWiki::defaultconfig();
11 $config{srcdir}=$config{destdir}="/dev/null";
13 my $installed = $ENV{INSTALLED_TESTS};
16 $config{templatedir} = "templates";
17 $config{underlaydir} = "underlays/basewiki";
18 $config{underlaydirbase} = "underlays";
23 $IkiWiki::pagesources{foo} = "foo.mdwn";
24 $IkiWiki::pagemtime{foo} = 42;
25 $IkiWiki::pagectime{foo} = 42;
26 $content = IkiWiki::filter("foo", "foo", $content);
27 $content = IkiWiki::preprocess("foo", "foo", $content);
28 $content = IkiWiki::linkify("foo", "foo", $content);
29 $content = IkiWiki::htmlize("foo", "foo", "mdwn", $content);
30 $content = IkiWiki::genpage("foo", $content);
34 foreach my $scrub (0, 1) {
36 $config{add_plugins}=[qw(color htmlscrubber toc)];
39 $config{add_plugins}=[qw(color toc)];
42 IkiWiki::loadplugins();
43 IkiWiki::checkconfig();
45 like(render('[[!color foreground="fuchsia" background="lime" text="Alert"]]'),
46 qr{(?s)<span class="color" style="color: fuchsia; background-color: lime">Alert</span>});
47 like(render('[[!color foreground="#336699" text="Hello"]]'),
48 qr{(?s)<span class="color" style="color: \#336699">Hello</span>});
49 like(render('[[!color background="#123" text="[Over there](http://localhost/)"]]'),
50 qr{(?s)<span class="color" style="background-color: \#123"><a href="http://localhost/">Over there</a></span>});
51 like(render('[[!color background="censored()" text="Hi"]]'),
52 qr{(?s)<span class="color" style="">Hi</span>});
53 like(render('[[!color foreground="x; pwned: exploit" text="Hi"]]'),
54 qr{(?s)<span class="color" style="">Hi</span>});
56 like(render("[[!toc ]]\n\n## [[!color foreground=red text=Important]]"),
57 qr{<a href="\#index1h2">Important</a>});