8 my $srcdir = "$tmp/in";
9 my $destdir = "$tmp/out";
11 my $installed = $ENV{INSTALLED_TESTS};
15 @command = qw(ikiwiki);
18 ok(! system("make -s ikiwiki.out"));
19 @command = qw(perl -I. ./ikiwiki.out
20 --underlaydir=underlays/basewiki
21 --set underlaydirbase=underlays
22 --templatedir=templates);
25 push @command, qw(--plugin meta --disable-plugin htmlscrubber);
26 push @command, $srcdir, $destdir;
28 sub write_build_read_compare {
29 my ($pagename, $input, $expected_output) = @_;
30 ok(! system("mkdir -p $srcdir"), q{setup});
31 writefile("$pagename.mdwn", $srcdir, $input);
32 ok(! system(@command), q{build});
33 like(readfile("$destdir/$pagename/index.html"), $expected_output);
34 ok(! system("rm -rf $tmp"), q{teardown});
37 write_build_read_compare(
39 q{[[!meta title="a page about bar"]]},
40 qr{<title>a page about bar</title>},
43 write_build_read_compare(
45 q{[[!meta description="a page about bar"]]},
46 qr{<meta name="description" content="a page about bar" />},
49 write_build_read_compare(
51 q{[[!meta guid="12345"]]},
52 qr{<meta name="guid" content="12345" />},
55 write_build_read_compare(
57 q{[[!meta license="you get to keep both pieces"]]},
58 qr{<div class="pagelicense">},
61 write_build_read_compare(
63 q{[[!meta copyright="12345"]]},
64 qr{<div class="pagecopyright">},
67 write_build_read_compare(
69 q{[[!meta enclosure="ikiwiki/login-selector/wordpress.png"]]},
70 qr{<meta name="enclosure" content="/ikiwiki/login-selector/wordpress.png" />},
73 write_build_read_compare(
75 q{[[!meta author="Noodly J. Appendage"]]},
76 qr{<meta name="author" content="Noodly J. Appendage" />},
79 write_build_read_compare(
81 q{[[!meta authorurl="http://noodly.appendage"]]},
82 qr{<meta name="authorurl" content="http://noodly.appendage" />},
85 write_build_read_compare(
87 q{[[!meta permalink="http://noodly.appendage"]]},
88 qr{<link rel="bookmark" href="http://noodly.appendage" />},
91 write_build_read_compare(
93 q{[[!meta date="12345"]]},
94 qr{<meta name="date" content="12345" />},
97 write_build_read_compare(
99 q{[[!meta updated="12345"]]},
100 qr{<meta name="updated" content="12345" />},
103 #write_build_read_compare(
105 # q{[[!meta stylesheet="wonka.css"]]},
106 # qr{<link href="wonka.css"},
109 #write_build_read_compare(
111 # q{[[!meta script="wonka.js"]]},
112 # qr{<link href="wonka.js"},
115 write_build_read_compare(
117 q{[[!meta openid="wonka.openid.example"]]},
118 qr{<link href="wonka\.openid\.example" rel="openid\.delegate" />},
121 write_build_read_compare(
123 q{[[!meta foaf="wonka.foaf.example"]]},
124 qr{<link rel="meta" type="application/rdf\+xml" title="FOAF"},
127 write_build_read_compare(
129 q{[[!meta redir="http://wonka.redir.example"]]},
130 qr{<meta http-equiv="refresh" content="0; URL=http://wonka\.redir\.example" />},
133 #write_build_read_compare(
135 # q{[[!meta link="http://wonka.link.example"]]},
136 # qr{<link href="http://wonka\.link\.example" />},
139 write_build_read_compare(
141 q{[[!meta name="thingy" value1="hi" value2="hello"]]},
142 qr{<meta name="thingy" value[0-9]{1}=".+?" value[0-9]{1}=".+?" />},
145 write_build_read_compare(
147 q{[[!meta keywords="word1,word2,word3"]]},
148 qr{<meta name="keywords" content="word1,word2,word3" />},
151 write_build_read_compare(
153 q{[[!meta moo="mooooo"]]},
154 qr{<meta name="moo" content="mooooo" />},
157 #write_build_read_compare(
159 # '[[!meta twitter:card="player"]]',
160 # qr{<meta name="twitter:card" content="player" />},
163 write_build_read_compare(
165 '[[!meta name="twitter:card" content="player"]]',
166 qr{<meta name="twitter:card" content="player" />},