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