latin: order rgb/cmy colour maps by hue
[sheet.git] / latin.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'latin alphabet cheat sheet',
5         version => '1.3',
6         description => [
7         ],
8         keywords => [qw'
9                 latin roman alphabet script letter unicode font glyph abc
10                 code encoding spelling symbol writing comparison character
11                 secret cursive fraktur blind braille morse deaf asl hand
12                 barcode bar color semaphore flag
13         '],
14         stylesheet => [qw( light dark red mono )],
15         data => ['writing-latn.inc.pl'],
16 });
17
18 :>
19 <style>
20         td {
21                 vertical-align: top;
22                 white-space: nowrap;
23         }
24         th {
25                 width: auto !important;
26         }
27
28         td svg {
29                 vertical-align: middle;
30         }
31         svg path:not([fill]) {
32                 stroke: currentColor;
33                 fill: none;
34         }
35         svg circle:not([fill]) {
36                 fill: currentColor;
37         }
38
39         .sample {
40                 vertical-align: middle;
41                 text-align: left;
42                 padding: 1px 0.3em;
43                 white-space: normal;
44         }
45 </style>
46
47 <h1>Latin alphabet</h1>
48
49 <p id=intro>Variant encodings of the common ASCII (latin, roman,
50 or <span title="fuck yeah!">'mercan</span>) letters A–Z.
51 Also see <a href="/writing">related alphabets</a>
52 and <a href="/chars/abc">font comparison</a>.</p>
53
54 <div>
55
56 <:
57 use List::Util qw( pairs );
58
59 my @table = do 'writing-latn.inc.pl';
60 if ($! or $@) {
61         Alert("Table data not found", $@ || $!);
62 }
63 else {
64         say '<style>';
65         for my $row (pairs @table) {
66                 my ($id, $info) = @{$row};
67                 my $style = $info->{style} or next;
68                 ref $style or $style = [$style];
69                 say "\t", !/^@/ && "#$id ", $_ for @{$style};
70         }
71         say "</style>\n";
72
73         my %VOWELCOLS = (map { ($_ => 1) } 0, 4, 8, 14, 20, 24);
74         say '<table class="glyphs">';
75         say '<thead><tr><th># <small>ASCII − 64</small>';
76         print '<td>', $_ for 1 .. 26;
77         say '</thead>';
78
79         for my $row (pairs @table) {
80                 my ($id, $info) = @{$row};
81
82                 printf '<tr id="%s">', $id;
83                 say '<th>', $info->{title} // ucfirst $id;
84
85                 my $colspan = 1;
86                 my $col = 0;
87                 for (@{ $info->{list} }) {
88                         $col++;
89                         if ($_ eq '>') {
90                                 $colspan++;
91                                 next;
92                         }
93                         my @class;
94                         push @class ,'l0' if $VOWELCOLS{$col - $colspan};
95                         push @class, $_ ? 'ex' : 'u-invalid' if s/^-//;
96
97                         print "\t<td";
98                         if ($col > 26) {
99                                 # special character for sample generation
100                                 print ' hidden';  # sample only
101                         }
102                         else {
103                                 print ' title=', chr($col + ord('A') - $colspan);
104                         }
105                         if ($colspan > 1) {
106                                 print " colspan=$colspan";
107                                 $colspan = 1;
108                         }
109                         printf ' class="%s"', "@class" if @class;
110                         print '>';
111                         say;
112                 }
113         }
114         say "</table>\n";
115 }
116
117 :></div>
118
119 <script type="text/javascript" src="/latinsample.js"></script>
120 <script type="text/javascript"> prependinput(document.getElementById('intro')) </script>
121