latin: less invasive html tag for coloured cards
[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'],
15         data => ['writing-latn.inc.pl'],
16 });
17
18 :>
19 <style>
20         @font-face {
21                 font-family: Suetterlin; /* R. G. Arens */
22                 src: url("/suetterlin.ttf");
23         }
24         #sütterlin td { font-family: Suetterlin }
25         #ita2 td,
26         #tap-code td,
27         #tap-simplified td {
28                 white-space: normal;
29                 word-spacing: 5em; /* force line break between words */
30         }
31         #tap-code td,
32         #tap-simplified td {
33                 line-height: 1ex;
34         }
35         #ita2 td {
36                 font-size: 50%;
37         }
38         #cards td {
39                 font-family: Symbola, "DejaVu Sans", serif, sans;
40         }
41         #pigpen {
42                 stroke-linecap: square;
43         }
44         #nyctographs,
45         #old-roman-cursive {
46                 stroke-linecap: round;
47                 stroke-linejoin: round;
48         }
49         td {
50                 white-space: nowrap;
51         }
52
53         .sample {
54                 vertical-align: middle;
55         }
56         #old-roman-cursive .sample span {
57                 margin-right: -10px;
58         }
59         #tap-code .sample,
60         #tap-simplified .sample {
61                 font-size: 80%;
62         }
63         #ita2 .sample,
64         #tap-code .sample,
65         #tap-simplified .sample {
66                 word-spacing: 0;
67         }
68         #ita2 .sample span,
69         #tap-code .sample span,
70         #tap-simplified .sample span {
71                 margin-right: 1ex;
72                 white-space: nowrap;
73         }
74         #morse .sample span {
75                 margin-right: 0.5ex;
76         }
77         #pigpen .sample svg {
78                 margin-right: 0.1em;
79         }
80         #nyctographs .sample svg {
81                 background: rgba(0,0,0, .1);
82                 padding: 0.1em;
83                 margin-right: 0.2em;
84         }
85
86         svg path:not([fill]) {
87                 stroke: currentColor;
88                 fill: none;
89         }
90         svg circle:not([fill]) {
91                 fill: currentColor;
92         }
93
94         td {
95                 vertical-align: top;
96         }
97         td > svg {
98                 vertical-align: middle;
99         }
100 </style>
101
102 <h1>Latin alphabet</h1>
103
104 <p id=intro>Variant encodings of the common ASCII (latin, roman,
105 or <span title="fuck yeah!">'mercan</span>) letters A–Z.
106 Also see <a href="/writing">related alphabets</a>
107 and <a href="/chars/abc">font comparison</a>.</p>
108
109 <div>
110
111 <:
112 use List::Util qw( pairs );
113
114 my @table = do 'writing-latn.inc.pl';
115 if ($! or $@) {
116         Alert("Table data not found", $@ || $!);
117 }
118 else {
119         say '<table class="glyphs">';
120         for my $row (pairs @table) {
121                 my ($title, $cells) = @{$row};
122                 printf '<tr id="%s">', (lc $title) =~ s/<[^>]+>//gr =~ s/\s+/-/gr;
123                 say '<th>', $title;
124                 my $colspan = 1;
125                 my $col = 0;
126                 for (@{$cells}) {
127                         $col++;
128                         if ($_ eq '>') {
129                                 $colspan++;
130                                 next;
131                         }
132                         print "\t<td";
133                         if ($colspan > 1) {
134                                 print " colspan=$colspan";
135                                 $colspan = 1;
136                         }
137                         print ' hidden' if $col > 26;  # sample only
138                         print ' class=', $_ ? 'ex' : 'u-invalid' if s/^-//;
139                         print '>';
140                         say;
141                 }
142         }
143         say "</table>\n";
144 }
145
146 :></div>
147
148 <script type="text/javascript" src="/latinsample.js"></script>
149 <script type="text/javascript"> prependinput(document.getElementById('intro')) </script>
150