X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/0e311de08dd204822e8b513ab71bbc6d50a171d7..58725794d72361cc70cb082476a32d08e22d21d0:/sc.plp
diff --git a/sc.plp b/sc.plp
index 6dfa65c..8d021b7 100644
--- a/sc.plp
+++ b/sc.plp
@@ -20,18 +20,25 @@ my %scvers = (
game => 'StarCraft II LotV',
major => 2,
},
+ index => 'bw',
+ 1 => 'bw',
+ 2 => 'lotv',
);
-$Request ||= 'bw';
-$Request = 'lotv' if $Request eq '2';
-my %scver = %{ $scvers{$Request} }
- or Abort("Requested version $Request not available", '404 unknown');
+my $requestver = $scvers{$Request ||= 'index'}
+ or Html(), Abort("Requested version $Request
not available", '404 request not found');
-my $datafile = "sc-units-$Request.inc.pl";
+if (ref $requestver ne 'HASH') {
+ $header{Location} = "/sc/$requestver";
+ Abort("Canonical URL for $Request is at $requestver", '302 subpage alias');
+}
+
+my %scver = %{$requestver};
+my $datafile = "sc-units-$Request";
Html({
title => "$scver{title} unit cheat sheet",
- version => '1.1',
+ version => '1.3',
description => [
"Reference of $scver{game} unit properties,"
. " comparing various statistics of all the units in $scver{name}"
@@ -45,15 +52,14 @@ Html({
$scver{major} < 2 ? qw' bw broodwar brood war ' :
qw' starcraft2 lotv hots wol ',
],
- stylesheet => [qw'light'],
- raw => '',
- data => [$datafile],
+ stylesheet => [qw( light dark )],
+ raw => '',
+ data => ["$datafile.inc.pl"],
});
say "