8 my $srcdir = "$tmp/in";
9 my $destdir = "$tmp/out";
11 my @command = (qw(./ikiwiki.out --plugin meta --disable-plugin htmlscrubber));
12 push @command, qw(-underlaydir=underlays/basewiki);
13 push @command, qw(-set underlaydirbase=underlays);
14 push @command, qw(--templatedir=templates);
15 push @command, $srcdir, $destdir;
17 sub write_build_read_compare {
18 my ($pagename, $input, $expected_output) = @_;
19 ok(! system("mkdir -p $srcdir"), q{setup});
20 writefile("$pagename.mdwn", $srcdir, $input);
21 ok(! system(@command), q{build});
22 like(readfile("$destdir/$pagename/index.html"), $expected_output);
23 ok(! system("rm -rf $tmp"), q{teardown});
26 write_build_read_compare(
28 q{[[!meta title="a page about bar"]]},
29 qr{<title>a page about bar</title>},
32 write_build_read_compare(
34 q{[[!meta description="a page about bar"]]},
35 qr{<meta name="description" content="a page about bar" />},
38 write_build_read_compare(
40 q{[[!meta guid="12345"]]},
41 qr{<meta name="guid" content="12345" />},
44 write_build_read_compare(
46 q{[[!meta license="you get to keep both pieces"]]},
47 qr{<div class="pagelicense">},
50 write_build_read_compare(
52 q{[[!meta copyright="12345"]]},
53 qr{<div class="pagecopyright">},
56 write_build_read_compare(
58 q{[[!meta enclosure="ikiwiki/login-selector/wordpress.png"]]},
59 qr{<meta name="enclosure" content="/ikiwiki/login-selector/wordpress.png" />},
62 write_build_read_compare(
64 q{[[!meta author="Noodly J. Appendage"]]},
65 qr{<meta name="author" content="Noodly J. Appendage" />},
68 write_build_read_compare(
70 q{[[!meta authorurl="http://noodly.appendage"]]},
71 qr{<meta name="authorurl" content="http://noodly.appendage" />},
74 write_build_read_compare(
76 q{[[!meta permalink="http://noodly.appendage"]]},
77 qr{<link rel="bookmark" href="http://noodly.appendage" />},
80 write_build_read_compare(
82 q{[[!meta date="12345"]]},
83 qr{<meta name="date" content="12345" />},
86 write_build_read_compare(
88 q{[[!meta updated="12345"]]},
89 qr{<meta name="updated" content="12345" />},
92 #write_build_read_compare(
94 # q{[[!meta stylesheet="wonka.css"]]},
95 # qr{<link href="wonka.css"},
98 #write_build_read_compare(
100 # q{[[!meta script="wonka.js"]]},
101 # qr{<link href="wonka.js"},
104 write_build_read_compare(
106 q{[[!meta openid="wonka.openid.example"]]},
107 qr{<link href="wonka\.openid\.example" rel="openid\.delegate" />},
110 write_build_read_compare(
112 q{[[!meta foaf="wonka.foaf.example"]]},
113 qr{<link rel="meta" type="application/rdf\+xml" title="FOAF"},
116 write_build_read_compare(
118 q{[[!meta redir="http://wonka.redir.example"]]},
119 qr{<meta http-equiv="refresh" content="0; URL=http://wonka\.redir\.example" />},
122 #write_build_read_compare(
124 # q{[[!meta link="http://wonka.link.example"]]},
125 # qr{<link href="http://wonka\.link\.example" />},
128 # XXX buggy? is this my bug? maybe twitter:foo would just work if this worked
129 #write_build_read_compare(
131 # q{[[!meta name="thingy" value1="hi" value2="hello"]]},
132 # qr{<meta name="thingy" value1="hi" value2="hello" />},
135 write_build_read_compare(
137 q{[[!meta keywords="word1,word2,word3"]]},
138 qr{<meta name="keywords" content="word1,word2,word3" />},
141 write_build_read_compare(
143 q{[[!meta moo="mooooo"]]},
144 qr{<meta name="moo" content="mooooo" />},
147 #write_build_read_compare(
149 # '[[!meta twitter:card="player"]]',
150 # qr{<meta name="twitter:card" content="player" />},
153 #write_build_read_compare(
155 # '[[!meta name="twitter:card" content="player"]]',
156 # qr{<meta name="twitter:card" content="player" />},