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