6 open my $footerfile, "<", shift @ARGV or die "footer: open: $!\n";
8 $footer .= $_ while <$footerfile>;
12 $arg =~ /(.*\/)?([^\/]+)\.html$/ or die;
14 open my $gamefile, "<", $arg or die "$arg: open: $!\n";
16 my $docname = $filename;
17 chomp(my $puzzlename = <$gamefile>);
18 while ($puzzlename =~ s/^([^:=]+)(=([^:]+))?://) {
19 if ($1 eq "unfinished") {
21 } elsif ($1 eq "docname") {
24 die "$arg: unknown keyword '$1'\n";
27 my $instructions = "";
28 $instructions .= $_ while <$gamefile>;
31 open my $outpage, ">", "${filename}.html";
33 my $unfinishedtitlefragment = $unfinished ? "an unfinished puzzle " : "";
34 my $unfinishedheading = $unfinished ? "<h2 align=center>an unfinished puzzle</h2>\n" : "";
38 $unfinishedpara = <<EOF;
40 You have found your way to a page containing an <em>unfinished</em>
41 puzzle in my collection, not linked from the <a href="../">main
42 puzzles page</a>. Don't be surprised if things are hard to understand
43 or don't work as you expect.
47 <a href="../">Back to main puzzles page</a> (which does not link to this)
53 <a href="../doc/${docname}.html#${docname}">Full instructions</a>
55 <a href="../">Back to main puzzles page</a>
62 <meta http-equiv="Content-Type" content="text/html; charset=ASCII" />
63 <title>${puzzlename}, ${unfinishedtitlefragment}from Simon Tatham's Portable Puzzle Collection</title>
64 <script type="text/javascript" src="${filename}.js"></script>
66 <body onLoad="initPuzzle();">
67 <h1 align=center>${puzzlename}</h1>
69 <h2 align=center>from Simon Tatham's Portable Puzzle Collection</h2>
74 <div id="puzzle" style="display: none">
76 <input type="button" id="new" value="New game">
77 <input type="button" id="restart" value="Restart game">
78 <input type="button" id="undo" value="Undo move">
79 <input type="button" id="redo" value="Redo move">
80 <input type="button" id="solve" value="Solve game">
81 <input type="button" id="specific" value="Enter game ID">
82 <input type="button" id="random" value="Enter random seed">
83 <select id="gametype"></select>
86 <table cellpadding="0" cellspacing="0">
89 <canvas id="puzzlecanvas" width="1" height="1" tabindex="1">
92 <td id="statusbarholder">
99 <a id="permalink-desc">by game ID</a>
100 <a id="permalink-seed">by random seed</a>
104 Sorry, this Javascript puzzle doesn't seem to work on your web
105 browser. Perhaps you have Javascript disabled, or perhaps your browser
106 doesn't provide a feature they depend on. These puzzles have been
107 successfully run in Firefox 19 and Chrome 25.