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"><:
19 my %styles = map {$_ => $_} qw(dark mono red);
20 our $style = exists $get{style} && $styles{$get{style}} || 'light';
21 printf(qq{\n<link rel="%s" type="text/css" media="all" href="%s" title="%s">},
22 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css", $_
28 <h1>Country codes</h1>
31 my $cc = do 'cc.inc.pl';
42 printf '<table class="mcmap">';
43 print '<col><colgroup span="26">';
44 for my $section (qw{thead}) {
45 print "<$section><tr><th>↱";
46 print '<th>', $_ for 'a' .. 'z';
50 for my $row ('a' .. 'z') {
51 print '<tr><th>', $row;
52 for my $col ('a' .. 'z') {
53 my $code = $row . $col;
54 my $country = $cc->{$code} or do {
55 print $code =~ /^x|^q[m-z]|^aa|^zz/ ? '<td class="X Co">' : '<td>';
58 my ($name, $class, $short, $ref) = @$country;
61 if (exists $get{show}) {
62 my $img = "flag/$ref.png";
63 $_ = sprintf '<img src="/%s" alt="%s">', $img, $ref if -e $img;
77 s/(\S)(\S+)-/$1-/g; # strip most chars preceding dash
78 s/(\S{4}[b-df-hj-np-tv-xz])(\S{2,})/$1./g; # abbreviate (at consonant)
81 $name =~ s/([^,]*), (.*)/$2 $1/;
82 printf "\n".'<td class="%s" title="%s">%s',
83 $_ ? 'X '.$class : '', quote("$code: $name"), $_;
94 <table class="glyphs"><tr>
95 <td class="X c-af">africa
96 <td class="X c-eu">europe
97 <td class="X c-as">asia
98 <td class="X c-aa">antarctica
99 <td class="X c-oc">oceania
100 <td class="X c-sa">south america
101 <td class="X c-na">north america
102 <td class="">reserved
103 <td class="X Co">user-assigned
108 <a href="/" rel="home">sheet.shiar.nl</a>/charset
109 <a href="git://git.shiar.nl/sheet" rel="vcs-git" title="Git repository"><:= $VERSION :></a>
110 created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
111 <a title="Licensed under the GNU Affero General Public License, version 3" rel="copyright"
112 href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a>