charset: check ucplanes for modification date
[sheet.git] / countries.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'country code cheat sheet',
5         version => '1.2',
6         description =>
7                 "Table of ISO-3166-1 country codes with the names of reserved territories.",
8         keywords => [qw'country code cc tld cctld continent territory land table'],
9         stylesheet => [qw'light dark circus mono red'],
10         data => ['countries.inc.pl'],
11 });
12
13 :>
14 <h1>ISO-3166-1α2 Country codes</h1>
15
16 <:
17 my $cc = do 'countries.inc.pl';
18
19 {
20         printf '<table class="mcmap">';
21         print '<col><colgroup span="26">';
22         for my $section (qw{thead}) {
23                 print "<$section><tr><th>↳";
24                 print '<th>', $_ for 'a' .. 'z';
25                 print "\n";
26         }
27         print '<tbody>';
28         for my $row ('a' .. 'z') {
29                 print '<tr><th>', $row;
30                 for my $col ('a' .. 'z') {
31                         my $code = $row . $col;
32                         my $country = $cc->{$code} or do {
33                                 print $code =~ /^x|^q[m-z]|^aa|^zz/ ? '<td class="X Co">' : '<td>';
34                                 next;
35                         };
36                         my ($name, $class, $short, $ref) = @$country;
37                         $name .= " → $ref" if $ref;
38                         $ref ||= $code;
39                         my $cell;
40                         if (exists $get{show}) {
41                                 sub showflag {
42                                         my ($cc) = @_;
43                                         my $img = "data/flag/$cc.png";
44                                         return -e $img &&
45                                                 sprintf '<img src="/%s" alt="%s">', $img, $cc;
46                                 }
47
48                                 $cell = showflag($code) // join(' ',
49                                         map { showflag($_) || $_ } split / /, $ref
50                                 );
51                         }
52                         else {
53                                 $cell = EscapeHTML($short || $name);
54                         }
55                         printf "\n".'<td class="%s" title="%s">%s',
56                                 $cell ? 'X '.$class : '', EscapeHTML("$code: $name"), $cell;
57                 }
58                 print "\n";
59         }
60         say '</table>';
61 }
62
63 :>
64 <hr>
65
66 <div class="legend">
67         <table class="glyphs"><tr>
68         <td class="X c-af">africa
69         <td class="X c-eu">europe
70         <td class="X c-as">asia
71         <td class="X c-an">antarctica
72         <td class="X c-oc">oceania
73         <td class="X c-sa">south america
74         <td class="X c-na">north america
75         <td class="X Xr">reserved
76         <td class="X Xi">org
77         <td class="">free
78         <td class="X Co">user-assigned
79         </table>
80
81         <div class="right">
82                 <ul class="legend legend-set">
83                 <li><strong>show</strong>
84                         <em><:= exists $get{show} ? 'flag images' : 'english names' :></em><:=
85                                 !exists $get{show} && ' by default' :>
86                 <li>default <strong>style</strong> is
87                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
88                 </ul>
89         </div>
90 </div>
91