latin: simplified edgewrite E variant
[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         }
44 </style>
45
46 <h1>Latin alphabet</h1>
47
48 <p id=intro>Variant encodings of the common ASCII (latin, roman,
49 or <span title="fuck yeah!">'mercan</span>) letters A–Z.
50 Also see <a href="/writing">related alphabets</a>
51 and <a href="/chars/abc">font comparison</a>.</p>
52
53 <div>
54
55 <:
56 use List::Util qw( pairs );
57
58 my @table = do 'writing-latn.inc.pl';
59 if ($! or $@) {
60         Alert("Table data not found", $@ || $!);
61 }
62 else {
63         say '<style>';
64         for my $row (pairs @table) {
65                 my ($id, $info) = @{$row};
66                 my $style = $info->{style} or next;
67                 ref $style or $style = [$style];
68                 say "\t", !/^@/ && "#$id ", $_ for @{$style};
69         }
70         say "</style>\n";
71
72         my %VOWELCOLS = (map { ($_ => 1) } 0, 4, 8, 14, 20, 24);
73         say '<table class="glyphs">';
74         say '<thead><tr><th># <small>ASCII − 64</small>';
75         print '<td>', $_ for 1 .. 26;
76         say '</thead>';
77
78         for my $row (pairs @table) {
79                 my ($id, $info) = @{$row};
80
81                 printf '<tr id="%s">', $id;
82                 say '<th>', $info->{title} // ucfirst $id;
83
84                 my $colspan = 1;
85                 my $col = 0;
86                 for (@{ $info->{list} }) {
87                         $col++;
88                         if ($_ eq '>') {
89                                 $colspan++;
90                                 next;
91                         }
92                         my @class;
93                         push @class ,'l0' if $VOWELCOLS{$col - $colspan};
94                         push @class, $_ ? 'ex' : 'u-invalid' if s/^-//;
95
96                         print "\t<td";
97                         if ($col > 26) {
98                                 # special character for sample generation
99                                 print ' hidden';  # sample only
100                         }
101                         else {
102                                 print ' title=', chr($col + ord('A') - $colspan);
103                         }
104                         if ($colspan > 1) {
105                                 print " colspan=$colspan";
106                                 $colspan = 1;
107                         }
108                         printf ' class="%s"', "@class" if @class;
109                         print '>';
110                         say;
111                 }
112         }
113         say "</table>\n";
114 }
115
116 :></div>
117
118 <script type="text/javascript" src="/latinsample.js"></script>
119 <script type="text/javascript"> prependinput(document.getElementById('intro')) </script>
120