%config=IkiWiki::defaultconfig();
$config{srcdir}=$config{destdir}="/dev/null";
+my $installed = $ENV{INSTALLED_TESTS};
+
+unless ($installed) {
+ $config{templatedir} = "templates";
+ $config{underlaydir} = "underlays/basewiki";
+ $config{underlaydirbase} = "underlays";
+}
+
sub render {
my $content = shift;
$IkiWiki::pagesources{foo} = "foo.mdwn";
foreach my $scrub (0, 1) {
if ($scrub) {
- $config{add_plugins}=[qw(color htmlscrubber)];
+ $config{add_plugins}=[qw(color htmlscrubber toc)];
}
else {
- $config{add_plugins}=[qw(color)];
+ $config{add_plugins}=[qw(color toc)];
}
IkiWiki::loadplugins();
qr{(?s)<span class="color" style="">Hi</span>});
like(render('[[!color foreground="x; pwned: exploit" text="Hi"]]'),
qr{(?s)<span class="color" style="">Hi</span>});
+
+ like(render("[[!toc ]]\n\n## [[!color foreground=red text=Important]]"),
+ qr{<a href="\#index1h2">Important</a>});
}
done_testing();