2d5b54c8a58812f010a9e30dca9fe820a47b9b11
[sheet.git] / unicode.plp
1 <:
2 use utf8;
3 use strict;
4 use warnings;
5 no  warnings 'qw';  # that's not a comment, it's a NUMBER SIGN
6 use open IO => ':utf8';
7
8 our $VERSION = '1.0';
9
10 $header{content_type} = 'text/html; charset=utf-8';
11
12 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
13  "http://www.w3.org/TR/html4/loose.dtd">
14 <html>
15
16 <head>
17 <title>digraph cheat sheet</title>
18 <meta http-equiv="content-type" content="utf-8">
19 <link rel="stylesheet" type="text/css" media="all" href="/digraphs.css">
20 <style>
21 table {
22         margin: 1ex 1ex 2ex;
23         float: left;
24         table-layout: auto;
25 }
26 thead td {
27         width: auto;
28 }
29 tbody {
30         border-width: 0;
31 }
32 h2, h3 {
33         clear: both;
34 }
35 h2 {
36         margin: 0 1ex;
37         font-size: 100%;
38 }
39
40 th {
41         text-align: left;
42         font-size: 50%;
43         background: #888;
44         background: #778;
45         background: #889;
46         color: #FFF;
47         padding: 0 0.2em;
48 }
49 th, td {
50         border-color: #778;
51         border: 1px solid #888;
52 }
53 thead td {
54         border: 0;
55         background: transparent;
56 }
57 thead th {
58         text-align: center;
59 }
60
61 td {
62         vertical-align: top;
63         margin: 0;
64         padding: 0;
65         width: 1.6em;
66 }
67 small {
68         font-size: 50%;
69         display: block;
70 }
71 small.digraph {
72         background: #888;
73         color: #FFF;
74
75         background: #000;
76         color: #FFF;
77         opacity: 0.3;
78 }
79 small.value {
80         background: #CCC;
81         color: #666;
82
83         background: #800;
84         color: #FFF;
85         opacity: 0.3;
86 }
87 </style>
88 </head>
89
90 <body>
91 <h1>Common Digraphs</h1>
92
93 <p>i^k in <a href="/">Vim</a>.
94 Also see the <a href="/digraphs">complete digraphs table</a>.</p>
95
96 <:
97 my $diinfo = do 'digraphs.inc.pl';
98 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
99         keys %$diinfo;
100
101 sub quote {
102         local $_ = shift;
103         s/"/&quot;/g;
104         s/</&lt;/g;
105         s/>/&gt;/g;
106         return $_;
107 }
108
109 sub table {
110         my ($width, $digraphs, $rowheads, $colheads) = @_;
111
112         my @rows;
113
114         my $colspan = 1;
115         for my $cell (@$digraphs) {
116                 my $class;
117                 if ($cell eq '.') {
118                         push @rows, '';
119                         $rows[-1] .= '<th>'.(shift @$rowheads || '&nbsp;') if $rowheads;
120                         next;
121                 }
122                 elsif ($cell eq '>') {
123                         $colspan++;
124                         next;
125                 }
126
127                 my $code = join '', map { $di{ord $_} || '' } split //, $cell;
128                 my $name = $diinfo->{$code}->[1];
129
130                 if ($cell =~ s/^-//) {
131 #                       $class = 'Empty';
132                 }
133                 elsif ($cell eq '=') {
134                         $class = 'Reserved';
135                         $cell = '';
136                 }
137                 elsif ($cell =~ /[ -~]/) {
138                         $class = 'Ascii';
139                 }
140                 elsif (not $code) {
141                         $class = 'DiNone';
142                 }
143                 elsif ($diinfo->{$code}->[2] =~ /\bXz\b/) {
144                         $class = 'DiProp';
145                 }
146                 else {
147                         $class = 'Di';
148                 }
149
150                 $rows[-1] .= sprintf('<td%s%s%s>%s%s',
151                         defined $name  ? qq{ title="$name"}  : '',
152                         defined $class ? qq{ class="$class"} : '',
153                         $colspan > 1 && qq{ colspan="$colspan"},
154                         $cell eq '' ? '&nbsp;' : quote($cell),
155                         $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))
156                                 : length($cell) == 1 && $cell !~ /[a-z]/
157                                         ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
158                                         : '',
159                 );
160
161                 $colspan = 1;
162         }
163
164         if ($colheads) {
165                 unshift @rows, sprintf '<thead><tr><td>%s<tbody>', join '',
166                         map { sprintf '<th title="%2$s">%s', split(/:/, $_, 2), '', '' }
167                         @$colheads
168         }
169
170         return sprintf "<table>\n%s</table>\n", join '', map {"<tr>$_\n"} @rows;
171 }
172
173 print "<h2>Common</h2>\n\n";
174 print table(@$_) for (
175         [ 3 => [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚}]],
176         [ 3 => [qw{. † ‡ • . § ¶ # . © ® ™ . − × ÷ . ± ² √}]],
177         [ 3 => [qw{. å ä ö ü ß . Å æ ø ű ſ}]],
178         [ 3 => [qw{. ¿ ç ñ é ê è}]],
179 );
180
181 print "<h2>Arrows</h2>\n\n";
182 print table(@$_) for (
183         [ 4 => [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}]],
184         [ 4 => [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}]],
185         [ 3 => [qw{. ◤ ▲ ◥ . ◀ ◆ ▶ . ◣ ▼ ◢}]],
186         [ 3 => [qw{. ◸ △ ◹ . ◁ ◇ ▷ . ◺ ▽ ◿}]],
187 );
188
189 print "<h2>Line drawing</h2>\n\n";
190 print table(@$_) for (
191         [ 4 => [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}]],
192         [ 4 => [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}]],
193         [ 3 => [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}]],
194         [ 3 => [qw{. ┎ ┰ ┒ . ┠ ╂ ┨ . ┖ ┸ ┚}]],
195         [ 4 => [qw{
196                 . ╴ ─ ╌ ┄ ┈ ╶ ╾
197                 . ╸ ━ ╍ ┅ ┉ ╺ ╼
198                 . ╵ │ ╎ ┆ ┊ ╷ ╿
199                 . ╹ ┃ ╏ ┇ ┋ ╻ ╽
200         }]],
201         [ 1 => [qw{. ╱ ╳ ╲ }]],
202         [ 4 => [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }]],
203         [ 3 => [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }]],
204         [ 3 => [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }]],
205 );
206
207 print "<h2>Blocks</h2>\n\n";
208 print table(@$_) for (
209         [ 3 => [qw{. ▘ ▀ ▝ . ▌ █ ▐ . ▖ ▄ ▗ }]],
210         [ 3 => [qw{. ░ . ▒ . ▓ }]],
211         [ 2 => [qw{. ▛ ▚ ▟ . ▙ ▞ ▜ }]],
212         [ 2 => [qw{. ▁ ▂ ▃ ▄ ▅ ▆ ▇ ▔ . ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▕ }]],
213         [ 3 => [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}]],
214 );
215
216 print "<h2>Signs</h2>\n\n";
217 print table(@$_) for (
218         [ 8 => [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}]],
219         [ 4 => [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}]],
220         [ 5 => [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}]],  # solar
221         [12 => [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}]],  # zodiac
222 );
223
224 print "<h2>IPA</h2>\n\n";
225 print table(@$_) for (
226         [
227                 12 => [qw{
228                         . p  p̪  >  >  t  ʈ  c  k  q  =  ʡ  ʔ
229                         . b  b̪  >  >  d  ɖ  ɟ  ɡ  ɢ  =  -  =
230                         . m  ɱ  >  >  n  ɳ  ɲ  ŋ  ɴ  =  =  =
231                         . ʙ  -  >  >  r  -  -  =  ʀ  =  -я =
232                         . -  ⱱ  >  >  ɾ  ɽ  -  =  ɢ̆  =  -  =
233                         . ɸ  f  θ  s  ʃ  ʂ  ç  x  χ  ħ  ʜ  h
234                         . β  v  ð  z  ʒ  ʐ  ʝ  ɣ  ʁ  ʕ  ʢ  ɦ
235                         . =  =  >  >  ɬ  -  -  -  -  =  =  =
236                         . =  =  >  >  ɮ  -  -  -  -  =  =  =
237                         . -  ʋ  >  >  ɹ  ɻ  j  ɰ  -  -  -  =
238                         . =  =  >  >  l  ɭ  ʎ  ʟ  -  =  =  =
239                         . ʘ  -  ǀ  ǁ  ǃ  -‼ ǂ  -  -  =  =  =
240                         . ɓ  ɗ̪  >  >  ɗ  -ᶑ ʄ  ɠ  ʛ  =  =  =
241                 }],
242                 [
243                         'Plosive',
244                         'Voiced plosive',
245                         'Nasal',
246                         'Trill',
247                         'Tap/flap',
248                         'Fricative',
249                         'Voiced fricative',
250                         'Lateral fricative',
251                         'Voiced lateral fricative',
252                         'Approximant',
253                         'Lateral approximant',
254                         'Click',
255                         'Implosive',
256                 ],
257                 [
258                         qw'BiL:Bilabial LD:Labiodental D:Dental Alv:Alveolar PA:Postalveolar Rf:Retroflex Pal:Palatal Vel:Velar Uv:Uvular Ph:Pharyngeal EG:Epiglottal Gl:Glottal',
259                 ],
260         ],
261         [
262                 6 => [qw{
263                         . i y  ɨ ʉ  ɯ u
264                         . - ɪ  ʏ -  ʊ -
265                         . e ø  ɘ ɵ  ɤ o
266                         . - -  ə -  - -
267                         . ɛ œ  ɜ ɞ  ʌ ɔ
268                         . æ -  ɐ -  - -
269                         . a ɶ  - -  ɑ ɒ
270                 }],
271                 [qw{Close Near-close Close-mid Mid Open-mid Near-open Open}],
272                 [map {substr($_, 0, 1).':'.$_, substr($_, 0, 1)." r:$_ rounded"} qw{Front Central Back}]
273         ],
274 );
275
276 print "<h2>Japanese</h2>\n\n";
277 print table(@$_) for (
278         [
279                 1 => [qw{
280                         . あ い う え お =
281                         . か き く け こ =
282                         . さ し す せ そ =
283                         . た ち つ て と =
284                         . な に ぬ ね の ん
285                         . は ひ ふ へ ほ =
286                         . ま み む め も =
287                         . や =  ゆ =  よ =
288                         . ら り る れ ろ =
289                         . わ ゐ =  ゑ を =
290                 }],
291                 ['', qw{K S T N H M Y R W}],
292                 [qw{A I U E O}, ''],
293         ],
294         [
295                 1 => [qw{
296                         . が ぎ ぐ げ ご
297                         . ざ じ ず ぜ ぞ
298                         . だ ぢ づ で ど
299                         . ば び ぶ べ ぼ
300                         . ぱ ぴ ぷ ぺ ぽ
301                 }],
302                 [qw{G Z D B P}],
303                 [qw{A I U E O}],
304         ],
305         [
306                 1 => [qw{
307                         . ア イ ウ エ オ ー
308                         . カ キ ク ケ コ =
309                         . サ シ ス セ ソ =
310                         . タ チ ツ テ ト =
311                         . ナ ニ ヌ ネ ノ ン
312                         . ハ ヒ フ ヘ ホ =
313                         . マ ミ ム メ モ =
314                         . ヤ -  ユ -  ヨ =
315                         . ラ リ ル レ ロ =
316                         . ワ ヰ -  ヱ ヲ =
317                 }],
318                 ['', qw{K S T N H M Y R W}],
319                 [qw{A I U E O}, ''],
320         ],
321         [
322                 1 => [qw{
323                         . ガ ギ グ ゲ ゴ
324                         . ザ ジ ズ ゼ ゾ
325                         . ダ ヂ ヅ デ ド
326                         . バ ビ ブ ベ ボ
327                         . パ ピ プ ペ ポ
328                         . ヷ ヸ ヴ ヹ ヺ
329                 }],
330                 [qw{G Z D B P V}],
331                 [qw{A I U E O}],
332         ],
333 );