X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/14e719f07fcb43c9a0ada3f9f9f018ff5a20a1cf..9d27cde5f8972684a5740f0adf070dd12d13269d:/cc.plp?ds=inline diff --git a/cc.plp b/cc.plp index 584884d..7d1b0d8 100644 --- a/cc.plp +++ b/cc.plp @@ -1,21 +1,17 @@ -<: -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'; :> - +
â±"; + print "<$section> | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
â³"; print ' | ', $_ for 'a' .. 'z'; print "\n"; } @@ -49,11 +37,32 @@ sub quote { print $code =~ /^x|^q[m-z]|^aa|^zz/ ? ' | ' : ' | '; next; }; - $code = $country->[2] if defined $country->[2]; - my $img = sprintf '', $code, $code - if -e "flag/$code.png"; + my ($name, $class, $short, $ref) = @$country; + $ref ||= $code; + local $_ = $ref; + if (exists $get{show}) { + my $img = "flag/$ref.png"; + $_ = sprintf '', $img, $ref if -e $img; + } + else { + $_ = $short || $name; + s/,.*//; + s/(?<=.)\(.*\)\s*//; + s/ republic\b//gi; + s/ islands?\b//gi; + s/\bthe //g; + s/ and / & /g and s/(?<=.)[a-z ]+//g; + s/\bsaint /st /gi; + 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', - $img ? 'X '.$country->[1] : '', quote($country->[0]), $img; + $_ ? 'X '.$class : '', EscapeHTML("$code: $name"), $_; } print "\n"; } @@ -68,21 +77,33 @@ sub quote { | africa | europe | asia - | oceania | antarctica + | oceania | south america | north america - | reserved + | reserved | user-assigned |