sc: declare bw energy data
[sheet.git] / countries.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'country code cheat sheet',
5         version => 'v1.1',
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 });
11
12 :>
13 <h1>ISO-3166-1α2 Country codes</h1>
14
15 <:
16 my $cc = do 'countries.inc.pl';
17
18 {
19         printf '<table class="mcmap">';
20         print '<col><colgroup span="26">';
21         for my $section (qw{thead}) {
22                 print "<$section><tr><th>↳";
23                 print '<th>', $_ for 'a' .. 'z';
24                 print "\n";
25         }
26         print '<tbody>';
27         for my $row ('a' .. 'z') {
28                 print '<tr><th>', $row;
29                 for my $col ('a' .. 'z') {
30                         my $code = $row . $col;
31                         my $country = $cc->{$code} or do {
32                                 print $code =~ /^x|^q[m-z]|^aa|^zz/ ? '<td class="X Co">' : '<td>';
33                                 next;
34                         };
35                         my ($name, $class, $short, $ref) = @$country;
36                         $ref ||= $code;
37                         local $_ = $ref;
38                         if (exists $get{show}) {
39                                 my $img = "data/flag/$ref.png";
40                                 $_ = sprintf '<img src="/%s" alt="%s">', $img, $ref if -e $img;
41                         }
42                         else {
43                                 $_ = EscapeHTML($short || $name);
44                                 $name .= " → $ref" if $ref and $ref ne $code;
45                         }
46                         printf "\n".'<td class="%s" title="%s">%s',
47                                 $_ ? 'X '.$class : '', EscapeHTML("$code: $name"), $_;
48                 }
49                 print "\n";
50         }
51         print "</table>\n";
52 }
53
54 :>
55 <hr>
56
57 <div class="legend">
58         <table class="glyphs"><tr>
59         <td class="X c-af">africa
60         <td class="X c-eu">europe
61         <td class="X c-as">asia
62         <td class="X c-an">antarctica
63         <td class="X c-oc">oceania
64         <td class="X c-sa">south america
65         <td class="X c-na">north america
66         <td class="X Xr">reserved
67         <td class="X Xi">org
68         <td class="">free
69         <td class="X Co">user-assigned
70         </table>
71
72         <div class="right">
73                 <ul class="legend legend-set">
74                 <li><strong>show</strong>
75                         <em><:= exists $get{show} ? 'flag images' : 'english names' :></em><:=
76                                 !exists $get{show} && ' by default' :>
77                 <li>default <strong>style</strong> is
78                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
79                 </ul>
80         </div>
81 </div>
82