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 enclosure="ikiwiki/login-selector/wordpress.png"]]},
71 qr{<meta name="enclosure" content="/ikiwiki/login-selector/wordpress.png" />},
74 write_build_read_compare(
76 q{[[!meta author="Noodly J. Appendage"]]},
77 qr{<meta name="author" content="Noodly J. Appendage" />},
80 write_build_read_compare(
82 q{[[!meta authorurl="http://noodly.appendage"]]},
83 qr{<meta name="authorurl" content="http://noodly.appendage" />},
86 write_build_read_compare(
88 q{[[!meta permalink="http://noodly.appendage"]]},
89 qr{<link rel="bookmark" href="http://noodly.appendage" />},
92 write_build_read_compare(
94 q{[[!meta date="12345"]]},
95 qr{<meta name="date" content="12345" />},
98 write_build_read_compare(
100 q{[[!meta updated="12345"]]},
101 qr{<meta name="updated" content="12345" />},
104 #write_build_read_compare(
106 # q{[[!meta stylesheet="wonka.css"]]},
107 # qr{<link href="wonka.css"},
110 #write_build_read_compare(
112 # q{[[!meta script="wonka.js"]]},
113 # qr{<link href="wonka.js"},
116 write_build_read_compare(
118 q{[[!meta openid="wonka.openid.example"]]},
119 qr{<link href="wonka\.openid\.example" rel="openid\.delegate" />},
122 write_build_read_compare(
124 q{[[!meta foaf="wonka.foaf.example"]]},
125 qr{<link rel="meta" type="application/rdf\+xml" title="FOAF"},
128 write_build_read_compare(
130 q{[[!meta redir="http://wonka.redir.example"]]},
131 qr{<meta http-equiv="refresh" content="0; URL=http://wonka\.redir\.example" />},
134 #write_build_read_compare(
136 # q{[[!meta link="http://wonka.link.example"]]},
137 # qr{<link href="http://wonka\.link\.example" />},
140 write_build_read_compare(
142 q{[[!meta name="thingy" value1="hi" value2="hello"]]},
143 qr{<meta name="thingy" value[0-9]{1}=".+?" value[0-9]{1}=".+?" />},
146 write_build_read_compare(
148 q{[[!meta keywords="word1,word2,word3"]]},
149 qr{<meta name="keywords" content="word1,word2,word3" />},
152 write_build_read_compare(
154 q{[[!meta moo="mooooo"]]},
155 qr{<meta name="moo" content="mooooo" />},
158 #write_build_read_compare(
160 # '[[!meta twitter:card="player"]]',
161 # qr{<meta name="twitter:card" content="player" />},
164 write_build_read_compare(
166 '[[!meta name="twitter:card" content="player"]]',
167 qr{<meta name="twitter:card" content="player" />},