diff options
| author | Simon Tatham <anakin@pobox.com> | 2017-09-20 10:22:28 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2017-09-20 18:03:44 +0100 |
| commit | 61e711178455dbd0ec8f78d15791b7e25fbf7156 (patch) | |
| tree | 592383dcb8205544006248cd57c7f3b25cc57b31 /html | |
| parent | d72db91888c1efddd56c67eee665b0a83c9329eb (diff) | |
| download | puzzles-61e711178455dbd0ec8f78d15791b7e25fbf7156.zip puzzles-61e711178455dbd0ec8f78d15791b7e25fbf7156.tar.gz puzzles-61e711178455dbd0ec8f78d15791b7e25fbf7156.tar.bz2 puzzles-61e711178455dbd0ec8f78d15791b7e25fbf7156.tar.xz | |
Build test HTML wrapper pages for the Javascript puzzles.
This should make it less annoying for me to do local testing of the JS
output of a build, before I push a change. There's a new
build.out/jstest directory containing .html files suitable for loading
in a local browser, which refer to the JS files via an appropriate
relative path to the existing build.out/js directory.
Diffstat (limited to 'html')
| -rwxr-xr-x | html/jspage.pl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/html/jspage.pl b/html/jspage.pl index 37eea30..b409783 100755 --- a/html/jspage.pl +++ b/html/jspage.pl @@ -3,6 +3,17 @@ use strict; use warnings; +my $jspath = ""; +while ($ARGV[0] =~ /^-/) { + my $opt = shift @ARGV; + last if $opt eq "--"; + if ($opt =~ /^--jspath=(.+)$/) { + $jspath = $1; + } else { + die "jspage.pl: unrecognised option '$opt'\n"; + } +} + open my $footerfile, "<", shift @ARGV or die "footer: open: $!\n"; my $footer = ""; $footer .= $_ while <$footerfile>; @@ -62,7 +73,7 @@ EOF <head> <meta http-equiv="Content-Type" content="text/html; charset=ASCII" /> <title>${puzzlename}, ${unfinishedtitlefragment}from Simon Tatham's Portable Puzzle Collection</title> -<script type="text/javascript" src="${filename}.js"></script> +<script type="text/javascript" src="${jspath}${filename}.js"></script> <style class="text/css"> /* Margins and centring on the top-level div for the game menu */ #gamemenu { margin-top: 0; margin-bottom: 0.5em; text-align: center } |