9 my $srcdir = "$tmp/in";
10 my $destdir = "$tmp/out";
12 my $installed = $ENV{INSTALLED_TESTS};
16 @command = qw(ikiwiki);
19 ok(! system("make -s ikiwiki.out"));
20 @command = ("perl", "-I".getcwd, qw(./ikiwiki.out
21 --underlaydir=underlays/basewiki
22 --set underlaydirbase=underlays
23 --templatedir=templates));
26 push @command, qw(--plugin meta --disable-plugin htmlscrubber);
27 push @command, $srcdir, $destdir;
29 sub write_build_read_compare {
30 my ($pagename, $input, $expected_output) = @_;
31 ok(! system("mkdir -p $srcdir"), q{setup});
32 writefile("$pagename.mdwn", $srcdir, $input);
33 ok(! system(@command), q{build});
34 like(readfile("$destdir/$pagename/index.html"), $expected_output);
35 ok(! system("rm -rf $tmp"), q{teardown});
38 write_build_read_compare(
40 q{[[!meta title="a page about bar"]]},
41 qr{<title>a page about bar</title>},
44 write_build_read_compare(
46 q{[[!meta description="a page about bar"]]},
47 qr{<meta name="description" content="a page about bar" />},
50 write_build_read_compare(
52 q{[[!meta guid="12345"]]},
53 qr{<meta name="guid" content="12345" />},
56 write_build_read_compare(
58 q{[[!meta license="you get to keep both pieces"]]},
59 qr{<div class="pagelicense">},
62 write_build_read_compare(
64 q{[[!meta copyright="12345"]]},
65 qr{<div class="pagecopyright">},
68 write_build_read_compare(
70 q{[[!meta author="Noodly J. Appendage"]]},
71 qr{<meta name="author" content="Noodly J. Appendage" />},
74 write_build_read_compare(
76 q{[[!meta authorurl="http://noodly.appendage"]]},
77 qr{<meta name="authorurl" content="http://noodly.appendage" />},
80 write_build_read_compare(
82 q{[[!meta permalink="http://noodly.appendage"]]},
83 qr{<link rel="bookmark" href="http://noodly.appendage" />},
86 write_build_read_compare(
88 q{[[!meta date="12345"]]},
89 qr{<meta name="date" content="12345" />},
92 write_build_read_compare(
94 q{[[!meta updated="12345"]]},
95 qr{<meta name="updated" content="12345" />},
98 #write_build_read_compare(
100 # q{[[!meta stylesheet="wonka.css"]]},
101 # qr{<link href="wonka.css"},
104 #write_build_read_compare(
106 # q{[[!meta script="wonka.js"]]},
107 # qr{<link href="wonka.js"},
110 write_build_read_compare(
112 q{[[!meta openid="wonka.openid.example"]]},
113 qr{<link href="wonka\.openid\.example" rel="openid\.delegate" />},
116 write_build_read_compare(
118 q{[[!meta foaf="wonka.foaf.example"]]},
119 qr{<link rel="meta" type="application/rdf\+xml" title="FOAF"},
122 write_build_read_compare(
124 q{[[!meta redir="http://wonka.redir.example"]]},
125 qr{<meta http-equiv="refresh" content="0; URL=http://wonka\.redir\.example" />},
128 #write_build_read_compare(
130 # q{[[!meta link="http://wonka.link.example"]]},
131 # qr{<link href="http://wonka\.link\.example" />},
134 write_build_read_compare(
136 q{[[!meta name="thingy" value1="hi" value2="hello"]]},
137 qr{<meta name="thingy" value[0-9]{1}=".+?" value[0-9]{1}=".+?" />},
140 write_build_read_compare(
142 q{[[!meta keywords="word1,word2,word3"]]},
143 qr{<meta name="keywords" content="word1,word2,word3" />},
146 write_build_read_compare(
148 q{[[!meta moo="mooooo"]]},
149 qr{<meta name="moo" content="mooooo" />},
152 #write_build_read_compare(
154 # '[[!meta twitter:card="player"]]',
155 # qr{<meta name="twitter:card" content="player" />},
158 write_build_read_compare(
160 '[[!meta name="twitter:card" content="player"]]',
161 qr{<meta name="twitter:card" content="player" />},