9 my $add_new_post = gettext("Add a new post titled:");
11 ok(! system("rm -rf t/tmp"));
12 ok(! system("mkdir t/tmp"));
18 writefile($name, "t/tmp/in", $content);
19 ok(utime(333333333, 333333333, "t/tmp/in/$name"));
22 write_old_file("protagonists.mdwn",
23 '[[!inline pages="protagonists/*" rootpage="protagonists/new"]]');
24 write_old_file("friends.mdwn",
25 '[[!inline pages="friends/*" postform=yes sort=title show=2]]');
26 write_old_file("antagonists.mdwn",
27 '[[!inline pages="antagonists/*"]]');
28 write_old_file("enemies.mdwn",
29 '[[!inline pages="enemies/*" postform=no rootpage=enemies sort=title reverse=yes show=2]]');
30 foreach my $page (qw(protagonists/shepard protagonists/link
31 antagonists/saren antagonists/ganondorf
32 friends/garrus friends/liara friends/midna friends/telma
33 enemies/benezia enemies/geth enemies/rachni
35 write_old_file("$page.mdwn", "this page is {$page}");
38 ok(! system("make -s ikiwiki.out"));
40 my $command = "perl -I. ./ikiwiki.out --set usedirs=0 --plugin inline --url=http://example.com --cgiurl=http://example.com/ikiwiki.cgi --rss --atom --underlaydir=underlays/basewiki --set underlaydirbase=underlays --templatedir=templates t/tmp/in t/tmp/out --verbose";
42 ok(! system($command));
44 ok(! system("$command --refresh"));
46 $blob = readfile("t/tmp/out/protagonists.html");
47 like($blob, qr{\Q$add_new_post\E}, 'rootpage=yes gives postform');
48 like($blob, qr{<input type="hidden" name="from" value="protagonists/new"},
49 'explicit rootpage is /protagonists/new');
51 $blob = readfile("t/tmp/out/friends.html");
52 like($blob, qr{\Q$add_new_post\E}, 'postform=yes forces postform');
53 like($blob, qr{<input type="hidden" name="from" value="friends"},
54 'implicit rootpage is /friends');
55 like($blob, qr[this page is {friends/garrus}.*this page is {friends/liara}]s,
56 'first two pages in desired sort order are present');
57 unlike($blob, qr{friends/(?:midna|telma)},
58 'pages excluded by show should not be present');
60 $blob = readfile("t/tmp/out/antagonists.html");
61 unlike($blob, qr{\Q$add_new_post\E}, 'default is no postform');
63 $blob = readfile("t/tmp/out/enemies.html");
64 unlike($blob, qr{\Q$add_new_post\E}, 'postform=no forces no postform');
65 like($blob, qr[this page is {enemies/zant}.*this page is {enemies/rachni}]s,
66 'first two pages in reversed sort order are present');
67 unlike($blob, qr{enemies/(?:benezia|geth)},
68 'pages excluded by show should not be present');