5 use open IO => ':utf8';
9 $header{content_type} = 'text/html; charset=utf-8';
11 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
12 "http://www.w3.org/TR/html4/loose.dtd">
16 <meta http-equiv="content-type" content="<:= $header{content_type} :>">
17 <title>country code cheat sheet</title>
18 <link rel="stylesheet" type="text/css" media="all" href="/base.css">
22 <h1>Country codes</h1>
25 my $cc = do 'cc.inc.pl';
36 printf '<table class="mcmap">';
38 for my $section (qw{thead}) {
39 print "<$section><tr><th>↱";
40 print '<th>', $_ for 'a' .. 'z';
44 for my $row ('a' .. 'z') {
45 print '<tr><th>', $row;
46 for my $col ('a' .. 'z') {
47 my $code = $row . $col;
48 my $country = $cc->{$code} or do {
49 print $code =~ /^x|^q[m-z]|^aa|^zz/ ? '<td class="X Co">' : '<td>';
52 my ($name, $class, $short, $ref) = @$country;
55 if (exists $get{show}) {
56 my $img = "flag/$ref.png";
57 $_ = sprintf '<img src="/%s" alt="%s">', $img, $ref if -e $img;
71 s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash
72 s/(\S{4}[b-df-hj-np-tv-xz])(\S{2,})/$1./g; # abbreviate (at consonant)
75 $name =~ s/([^,]*), (.*)/$2 $1/;
76 printf "\n".'<td class="%s" title="%s">%s',
77 $_ ? 'X '.$class : '', quote("$code: $name"), $_;
88 <table class="glyphs"><tr>
89 <td class="X c-af">africa
90 <td class="X c-eu">europe
91 <td class="X c-as">asia
92 <td class="X c-oc">oceania
93 <td class="X c-aa">antarctica
94 <td class="X c-sa">south america
95 <td class="X c-na">north america
96 <td class="X Xi">reserved
97 <td class="X Co">user-assigned
102 <a href="/" rel="home">sheet.shiar.nl</a>/charset
103 <a href="git://git.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
104 created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
105 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
106 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>