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