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