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