acca2b9d9fee2f9e8adae01e6ae1a25fad82ead3
[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
36 th {
37         text-align: left;
38         font-size: 50%;
39         background: #888;
40         color: #FFF;
41         padding: 0 0.2em;
42 }
43 thead td {
44         border: 0;
45 }
46
47 td {
48         background: transparent;
49         vertical-align: top;
50         margin: 0;
51         padding: 0;
52         width: 1.6em;
53 }
54 small {
55         font-size: 50%;
56         display: block;
57 }
58 small.digraph {
59         background: #888;
60         color: #FFF;
61 }
62 small.value {
63         background: #CCC;
64         color: #666;
65 }
66
67 td.empty {
68         background: #DDD;
69 }
70 td.reserved {
71         background: #BBB;
72 }
73 </style>
74 </head>
75
76 <body>
77 <h1>Common Digraphs</h1>
78
79 <p>i^k in <a href="/">Vim</a>.
80 Also see the <a href="/digraphs">complete digraphs table</a>.</p>
81
82 <:
83 my $diinfo = do 'digraphs.inc.pl';
84 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
85         keys %$diinfo;
86
87 sub quote {
88         local $_ = shift;
89         s/"/&quot;/g;
90         s/</&lt;/g;
91         s/>/&gt;/g;
92         return $_;
93 }
94
95 sub table {
96         my ($width, $digraphs, $rowheads, $colheads) = @_;
97
98         my @rows;
99
100         my $colspan = 1;
101         for my $cell (@$digraphs) {
102                 my $class;
103                 if ($cell eq '.') {
104                         push @rows, '';
105                         $rows[-1] .= '<th>'.(shift @$rowheads || '&nbsp;') if $rowheads;
106                         next;
107                 }
108                 elsif ($cell eq '>') {
109                         $colspan++;
110                         next;
111                 }
112                 elsif ($cell =~ s/^-//) {
113                         $class = 'empty';
114                 }
115                 elsif ($cell eq '=') {
116                         $class = 'reserved';
117                         $cell = '';
118                 }
119
120                 my $code = join '', map { $di{ord $_} || '' } split //, $cell;
121                 my $name = $diinfo->{$code}->[1];
122
123                 $rows[-1] .= sprintf('<td%s%s%s>%s%s',
124                         defined $name  ? qq{ title="$name"}  : '',
125                         defined $class ? qq{ class="$class"} : '',
126                         $colspan > 1 && qq{ colspan="$colspan"},
127                         $cell eq '' ? '&nbsp;' : quote($cell),
128                         $code ne '' ? sprintf(' <small class="digraph">%s</small>', quote($code))
129                                 : length($cell) == 1 && $cell !~ /[a-z]/
130                                         ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
131                                         : '',
132                 );
133
134                 $colspan = 1;
135         }
136
137         if ($colheads) {
138                 unshift @rows, sprintf '<thead><tr><td>%s<tbody>', join '',
139                         map { sprintf '<th title="%2$s">%s', split(/:/, $_, 2), '', '' }
140                         @$colheads
141         }
142
143         return sprintf "<table>\n%s</table>\n", join '', map {"<tr>$_\n"} @rows;
144 }
145
146 print "<h2>Common</h2>\n\n";
147 print table(@$_) for (
148         [ 3 => [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚}]],
149         [ 3 => [qw{. † ‡ • . § ¶ # . © ® ™ . − × ÷ . ± ² √}]],
150         [ 3 => [qw{. å ä ö ü ß . Å æ ø ű ſ}]],
151         [ 3 => [qw{. ¿ ç ñ é ê è}]],
152 );
153
154 print "<h2>Arrows</h2>\n\n";
155 print table(@$_) for (
156         [ 4 => [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}]],
157         [ 4 => [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}]],
158         [ 3 => [qw{. ◤ ▲ ◥ . ◀ ◆ ▶ . ◣ ▼ ◢}]],
159         [ 3 => [qw{. ◸ △ ◹ . ◁ ◇ ▷ . ◺ ▽ ◿}]],
160 );
161
162 print "<h2>Line drawing</h2>\n\n";
163 print table(@$_) for (
164         [ 4 => [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}]],
165         [ 4 => [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}]],
166         [ 3 => [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}]],
167         [ 3 => [qw{. ┎ ┰ ┒ . ┠ ╂ ┨ . ┖ ┸ ┚}]],
168         [ 4 => [qw{
169                 . ╴ ─ ╌ ┄ ┈ ╶ ╾
170                 . ╸ ━ ╍ ┅ ┉ ╺ ╼
171                 . ╵ │ ╎ ┆ ┊ ╷ ╿
172                 . ╹ ┃ ╏ ┇ ┋ ╻ ╽
173         }]],
174         [ 1 => [qw{. ╱ ╳ ╲ }]],
175         [ 4 => [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }]],
176         [ 3 => [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }]],
177         [ 3 => [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }]],
178 );
179
180 print "<h2>Blocks</h2>\n\n";
181 print table(@$_) for (
182         [ 3 => [qw{. ▘ ▀ ▝ . ▌ █ ▐ . ▖ ▄ ▗ }]],
183         [ 3 => [qw{. ░ . ▒ . ▓ }]],
184         [ 2 => [qw{. ▛ ▚ ▟ . ▙ ▞ ▜ }]],
185         [ 2 => [qw{. ▁ ▂ ▃ ▄ ▅ ▆ ▇ ▔ . ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▕ }]],
186         [ 3 => [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}]],
187 );
188
189 print "<h2>Signs</h2>\n\n";
190 print table(@$_) for (
191         [ 8 => [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}]],
192         [ 4 => [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}]],
193         [ 5 => [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}]],  # solar
194         [12 => [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}]],  # zodiac
195 );
196
197 print "<h2>IPA</h2>\n\n";
198 print table(@$_) for (
199         [
200                 12 => [qw{
201                         . p  p̪  >  >  t  ʈ  c  k  q  =  ʡ  ʔ
202                         . b  b̪  >  >  d  ɖ  ɟ  ɡ  ɢ  =  -  =
203                         . m  ɱ  >  >  n  ɳ  ɲ  ŋ  ɴ  =  =  =
204                         . ʙ  -  >  >  r  -  -  =  ʀ  =  -я =
205                         . -  ⱱ  >  >  ɾ  ɽ  -  =  ɢ̆  =  -  =
206                         . ɸ  f  θ  s  ʃ  ʂ  ç  x  χ  ħ  ʜ  h
207                         . β  v  ð  z  ʒ  ʐ  ʝ  ɣ  ʁ  ʕ  ʢ  ɦ
208                         . =  =  >  >  ɬ  -  -  -  -  =  =  =
209                         . =  =  >  >  ɮ  -  -  -  -  =  =  =
210                         . -  ʋ  >  >  ɹ  ɻ  j  ɰ  -  -  -  =
211                         . =  =  >  >  l  ɭ  ʎ  ʟ  -  =  =  =
212                         . ʘ  -  ǀ  ǁ  ǃ  -‼ ǂ  -  -  =  =  =
213                         . ɓ  ɗ̪  >  >  ɗ  -ᶑ ʄ  ɠ  ʛ  =  =  =
214                 }],
215                 [
216                         'Plosive',
217                         'Voiced plosive',
218                         'Nasal',
219                         'Trill',
220                         'Tap/flap',
221                         'Fricative',
222                         'Voiced fricative',
223                         'Lateral fricative',
224                         'Voiced lateral fricative',
225                         'Approximant',
226                         'Lateral approximant',
227                         'Click',
228                         'Implosive',
229                 ],
230                 [
231                         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',
232                 ],
233         ],
234         [
235                 6 => [qw{
236                         . i y  ɨ ʉ  ɯ u
237                         . - ɪ  ʏ -  ʊ -
238                         . e ø  ɘ ɵ  ɤ o
239                         . - -  ə -  - -
240                         . ɛ œ  ɜ ɞ  ʌ ɔ
241                         . æ -  ɐ -  - -
242                         . a ɶ  - -  ɑ ɒ
243                 }],
244                 [qw{Close Near-close Close-mid Mid Open-mid Near-open Open}],
245                 [map {substr($_, 0, 1).':'.$_, substr($_, 0, 1)." r:$_ rounded"} qw{Front Central Back}]
246         ],
247 );
248
249 print "<h2>Japanese</h2>\n\n";
250 print table(@$_) for (
251         [
252                 1 => [qw{
253                         . あ い う え お =
254                         . か き く け こ =
255                         . さ し す せ そ =
256                         . た ち つ て と =
257                         . な に ぬ ね の ん
258                         . は ひ ふ へ ほ =
259                         . ま み む め も =
260                         . や =  ゆ =  よ =
261                         . ら り る れ ろ =
262                         . わ ゐ =  ゑ を =
263                 }],
264                 ['', qw{K S T N H M Y R W}],
265                 [qw{A I U E O}, ''],
266         ],
267         [
268                 1 => [qw{
269                         . が ぎ ぐ げ ご
270                         . ざ じ ず ぜ ぞ
271                         . だ ぢ づ で ど
272                         . ば び ぶ べ ぼ
273                         . ぱ ぴ ぷ ぺ ぽ
274                 }],
275                 [qw{G Z D B P}],
276                 [qw{A I U E O}],
277         ],
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                 }],
303                 [qw{G Z D B P V}],
304                 [qw{A I U E O}],
305         ],
306 );