X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/e98b059d1f6bbd6ac8ca06de152959536e4b98b0..c11640facf0c976140547ef1b58971ec8a661dd3:/cc.plp diff --git a/cc.plp b/cc.plp index 2b67523..7138c3b 100644 --- a/cc.plp +++ b/cc.plp @@ -1,12 +1,5 @@ -<: -use utf8; -use strict; -use warnings; -use open IO => ':utf8'; - -our $VERSION = 'v1.0'; - -$header{content_type} = 'text/html; charset=utf-8'; +<(common.inc.plp)><: + our $VERSION = 'v1.0'; :> @@ -15,13 +8,7 @@ $header{content_type} = 'text/html; charset=utf-8'; country code cheat sheet -<: - my %styles = map {$_ => $_} qw(dark mono red); - our $style = exists $get{style} && $styles{$get{style}} || 'light'; - printf(qq{\n}, - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css", $_ - ) for keys %styles; -:> +<:= stylesheet(qw'light dark mono red') :> @@ -30,19 +17,11 @@ $header{content_type} = 'text/html; charset=utf-8'; <: my $cc = do 'cc.inc.pl'; -sub quote { - local $_ = shift; - s/"/"/g; - s//>/g; - return $_; -} - { printf ''; print ''; for my $section (qw{thead}) { - print "<$section>
↱"; + print "<$section>
↳"; print '', $_ for 'a' .. 'z'; print "\n"; } @@ -69,18 +48,18 @@ sub quote { s/ republic\b//gi; s/ islands?\b//gi; s/\bthe //g; - s/ and / & /g; + s/ and / & /g and s/(?<=.)[a-z ]+//g; s/\bsaint /st /gi; - s/South /S-/g; - s/North /N-/g; + s/South(?:ern)? /S-/g; + s/North(?:ern)? /N-/g; s/New /n./g; s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash - s/(\S{4}[b-df-hj-np-tv-xz])(\S{2,})/$1./g; # abbreviate (at consonant) - $_ = quote($_); + s/(\S{4}[b-df-hj-np-tv-xz])((?%s', - $_ ? 'X '.$class : '', quote("$code: $name"), $_; + $_ ? 'X '.$class : '', EscapeHTML("$code: $name"), $_; } print "\n"; } @@ -102,14 +81,26 @@ sub quote { reserved user-assigned
+ +
+ +