bc3ee705363bd7d8b1e6d4747e30d6ebf77e648c
[sheet.git] / unicode.plp
1 <(common.inc.plp)><:
2         our $VERSION = 'v1.0';
3
4 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
5  "http://www.w3.org/TR/html4/loose.dtd">
6 <html lang="en">
7
8 <head>
9 <meta http-equiv="content-type" content="utf-8">
10 <title>digraph cheat sheet</title>
11 <meta name="description" content="Common Unicode characters with digraph or code point, layed out for quick location. Includes general signs, arrows, drawing characters, and IPA letters.">
12 <meta name="keywords" content="unicode, glyph, char, character, reference, common, ipa, sign, mark, table, digraph">
13 <:= stylesheet(qw'light dark red') :>
14 </head>
15
16 <body id="unicode">
17 <h1>Common uncommon Unicode</h1>
18
19 <p>i^k in <a href="/">Vim</a>.
20 Also see the <a href="/digraphs">complete digraphs table</a>.</p>
21
22 <div class="diinfo">
23
24 <:
25 my $diinfo = do 'digraphs.inc.pl';
26 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
27         sort { length $a <=> length $b } keys %$diinfo;
28
29 sub glyph_table {
30         my ($digraphs) = @_;
31
32         my @rows;
33
34         my @colheads;
35         while ($digraphs->[0] !~ /^\./) {
36                 my $cell = shift @$digraphs or last;
37                 push @colheads, sprintf(
38                         '<%s%s>%s',
39                         $cell =~ s/^-// ? 'td' : 'th',
40                         $cell =~ s/:(.*)// ? qq{ title="$1"} : '',
41                         $cell eq '_' ? '&nbsp;' : $cell
42                 );
43         }
44         push @rows, sprintf '<thead><tr>%s<tbody>', join '', @colheads if @colheads;
45
46         my $colspan = 1;
47         for my $cell (@$digraphs) {
48                 if ($cell =~ s/^\.//) {
49                         # dot indicates start of a new row
50                         push @rows, '';
51                         if ($cell =~ s/^>//) {
52                                 # header cell text follows
53                                 $cell =~ s/_/ /g;  # underscores may be used instead of whitespace (for qw//ability)
54                                 $rows[-1] .= '<th>'.($cell || '&nbsp;');
55                         }
56                         next;
57                 }
58                 elsif ($cell eq '>') {
59                         # merge this cell to the next column
60                         $colspan++;
61                         next;
62                 }
63
64                 my ($code, $name);
65
66                 # determine display class
67                 my @class;
68                 if ($cell eq '-') {
69                         $cell = '';
70                 }
71                 elsif ($cell eq '=') {
72                         push @class, 'di-invalid';
73                         $cell = '';
74                 }
75                 else {
76                         if ($cell =~ s/^-//) {
77                                 push @class, 'di-rare'; # discouraged
78                         }
79
80                         $code = join '', map { $di{ord $_} || '' } split //, $cell;
81                         $name = $diinfo->{$code}->[1];
82                         length $code == 2 or undef $code;
83
84                         if (defined $code) {
85                                 push @class, 'di-d'; # digraph
86                                 push @class, 'di-prop' # unofficial
87                                         if $diinfo->{$code}->[2] =~ /\bXz\b/;
88                         }
89                         elsif (defined $name) {
90                                 push @class, 'X';
91                         }
92
93                         if ($cell =~ /[ -~]/) {
94                                 push @class, 'di-a'; # ascii
95                         }
96                         else {
97                                 push @class, 'di-b'; # basic unicode
98                         }
99                 }
100
101                 # add cell html
102                 $rows[-1] .= sprintf('<td%s%s%s>%s%s',
103                         defined $name  ? qq{ title="$name"}  : '',
104                         @class ? sprintf(' class="%s"', join ' ', @class) : '',
105                         $colspan > 1 && qq{ colspan="$colspan"},
106                         $cell eq '' ? '&nbsp;' : EscapeHTML($cell),
107                         defined $code ? sprintf(' <small class="digraph">%s</small>', EscapeHTML($code))
108                                 : length($cell) == 1 && $cell !~ /[a-z]/
109                                         ? sprintf(' <small class="%s">%04X</small>', 'value', ord $cell)
110                                         : '',
111                 );
112
113                 $colspan = 1;
114         }
115
116         return sprintf qq{<table class="glyphs dilabel">\n%s</table>\n},
117                 join '', map {"<tr>$_\n"} @rows;
118 }
119
120 sub print_glyph_tables {
121         while (@_) {
122                 printf '<div class="section"><h2>%s</h2>'."\n\n", shift;
123                 while (ref $_[0] and $_ = shift) {
124                         print glyph_table($_);
125                 }
126                 print '</div>';
127         }
128 }
129
130 our $verbose = exists $get{v};
131
132 print_glyph_tables(
133         'Popular',
134         [qw{. « » . ‹ › . ‘ ’ . “ ” . „ ‚ . ‟ ‛}],
135         [qw{. † ‡ • . § ¶ # . © ® ™ . ° ′ ″ . − × ÷ . ± ² √}],
136         [qw{. ⚋ ⚊ . ⚐ ⚑ . ☺ ☹ . ✓ ✗ . ✔ ✘ . ◄ ► }],
137         [qw{. å ä ö ü ß . ā æ ø ű ſ}],
138         [qw{. ¿ ç ñ é ê è}],
139         [qw{. α β}], [qw{. א}],
140
141         'Signs',
142         [qw{. ¤ ¢ ₥ € £ ₨ $ ¥ . ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}],
143         [qw{. ♠ ♡ ♢ ♣ . ♤ ♥ ♦ ♧}],
144         [qw{. ☉ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}],  # solar
145         [qw{. ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}],  # zodiac
146
147         'Arrows',
148         [qw{. ↖ ↑ ↗ ↔ . ← - → ↕ . ↙ ↓ ↘ -}],
149         [qw{. ⇖ ⇑ ⇗ ⇔ . ⇐ - ⇒ ⇕ . ⇙ ⇓ ⇘ -}],
150         [qw{. ⬁ ⇧ ⬀ ⬄ . ⇦ - ⇨ ⇳ . ⬃ ⇩ ⬂ -}],
151         [qw{. ⬉ ⬆ ⬈ ⬌ . ⬅ - ➡ ⬍ . ⬋ ⬇ ⬊ -}],
152         [qw{. ◩ ⬒ ⬔   . ◧ □ ◨   . ⬕ ⬓ ◪  }],
153         [qw{. ◤ ▲ ◥   . ◀ ◆ ▶   . ◣ ▼ ◢  }],
154         [qw{. ◸ △ ◹   . ◁ ◇ ▷   . ◺ ▽ ◿  }],
155 $verbose ? (
156         [qw{.    .  -  .    }],
157         [qw{.    .  -  .    }],
158 ) : (),
159
160         'Line drawing',
161         [qw{. ╔ ╦ ╗ ═ . ╠ ╬ ╣ ║ . ╚ ╩ ╝ - }],
162         [qw{. ╒ ╤ ╕ . ╞ ╪ ╡ . ╘ ╧ ╛ }],
163         [qw{. ╓ ╥ ╖ . ╟ ╫ ╢ . ╙ ╨ ╜ }],
164         [qw{. ┌ ┬ ┐ . ├ ┼ ┤ . └ ┴ ┘}],
165         [qw{. ┏ ┳ ┓ . ┣ ╋ ┫ . ┗ ┻ ┛}],
166         [qw{. ┍ ┯ ┑ . ┝ ┿ ┥ . ┕ ┷ ┙}],
167         [qw{. ┎ ┰ ┒ . ┠ ╂ ┨ . ┖ ┸ ┚}],
168         [qw{
169                 . ╴ ─ ╌ ┄ ┈ ╶ ╾
170                 . ╸ ━ ╍ ┅ ┉ ╺ ╼
171                 . ╵ │ ╎ ┆ ┊ ╷ ╿
172                 . ╹ ┃ ╏ ┇ ┋ ╻ ╽
173         }],
174         [qw{. ╱ ╳ ╲ }],
175
176         'Blocks',
177         [qw{. □ ▣ ■ . ▤ ▦ ▥ . ▧ ▩ ▨}],
178         [qw{. ░ . ▒ . ▓ }],
179         [qw{. ▘ ▀ ▝ . ▌ █ ▐ . ▖ ▄ ▗ }],
180         [qw{. ▛ ▚ ▟ . ▙ ▞ ▜ }],
181         [qw{. ▁ ▂ ▃ ▄ ▅ ▆ ▇ ▔ . ▏ ▎ ▍ ▌ ▋ ▊ ▉ ▕ }],
182
183         'IPA',
184         [qw{
185                 - BiL:Bilabial LD:Labiodental D:Dental Alv:Alveolar PA:Postalveolar
186                   Rf:Retroflex Pal:Palatal Vel:Velar Uv:Uvular Ph:Pharyngeal
187                   EG:Epiglottal Gl:Glottal
188                 .>Plosive                   p  -ȹ >  >  t  ʈ  c  k  q  =  ʡ  ʔ
189                 .>Voiced_Plosive            b  -ȸ >  >  d  ɖ  ɟ  ɡ  ɢ  =  -  =
190                 .>Nasal                     m  ɱ  >  >  n  ɳ  ɲ  ŋ  ɴ  =  =  =
191                 .>Trill                     ʙ  -  >  >  r  -  -  =  ʀ  =  -я =
192                 .>Tap/flap                  -  ⱱ  >  >  ɾ  ɽ  -  =  ɢ̆  =  -  =
193                 .>Fricative                 ɸ  f  θ  s  ʃ  ʂ  ç  x  χ  ħ  ʜ  h
194                 .>Voiced_fricative          β  v  ð  z  ʒ  ʐ  ʝ  ɣ  ʁ  ʕ  ʢ  ɦ
195                 .>Lateral_fricative         =  =  >  >  ɬ  -  -  -  -  =  =  =
196                 .>Voiced_lateral_fricative  =  =  >  >  ɮ  -  -  -  -  =  =  =
197                 .>Approximant               -  ʋ  >  >  ɹ  ɻ  j  ɰ  -  -  -  =
198                 .>Lateral_approximant       =  =  >  >  l  ɭ  ʎ  ʟ  -  =  =  =
199                 .>Click                     ʘ  -  ǀ  ǁ  ǃ  -‼ ǂ  -  -  =  =  =
200                 .>Implosive                 ɓ  ɗ̪  >  >  ɗ  -ᶑ ʄ  ɠ  ʛ  =  =  =
201         }],
202         [qw{
203                 co . ɕ . ʑ . ɧ . ɥ . ʍ . w
204         }],
205         [(
206                 '-',
207                 map { substr($_, 0, 1).':'.$_, substr($_, 0, 1)." r:$_ rounded" }
208                 qw{Front Central Back}
209         ), qw{
210                 .>Close      i y  ɨ ʉ  ɯ u
211                 .>Near-close ɪ ʏ  - -  - ʊ
212                 .>Close-mid  e ø  ɘ ɵ  ɤ o
213                 .>Mid        - -  ə -  - -
214                 .>Open-mid   ɛ œ  ɜ ɞ  ʌ ɔ
215                 .>Near-open  æ -  ɐ -  - -
216                 .>Open       a ɶ  - -  ɑ ɒ
217         }],
218
219 $verbose ? (
220         'Japanese',
221         [qw{
222                   - A  I  U  E  O  _
223                 .>  あ い う え お =
224                 .>K か き く け こ =
225                 .>S さ し す せ そ =
226                 .>T た ち つ て と =
227                 .>N な に ぬ ね の ん
228                 .>H は ひ ふ へ ほ =
229                 .>M ま み む め も =
230                 .>Y や =  ゆ =  よ =
231                 .>R ら り る れ ろ =
232                 .>W わ -ゐ = -ゑ を =
233         }],
234         [qw{
235                   - A  I  U  E  O
236                 .>G が ぎ ぐ げ ご
237                 .>Z ざ じ ず ぜ ぞ
238                 .>D だ ぢ づ で ど
239                 .>B ば び ぶ べ ぼ
240                 .>P ぱ ぴ ぷ ぺ ぽ
241         }],
242         [qw{
243                   - A  I  U  E  O  _
244                 .>  ア イ ウ エ オ ー
245                 .>K カ キ ク ケ コ =
246                 .>S サ シ ス セ ソ =
247                 .>T タ チ ツ テ ト =
248                 .>N ナ ニ ヌ ネ ノ ン
249                 .>H ハ ヒ フ ヘ ホ =
250                 .>M マ ミ ム メ モ =
251                 .>Y ヤ -  ユ -  ヨ =
252                 .>R ラ リ ル レ ロ =
253                 .>W ワ ヰ -  ヱ ヲ =
254         }],
255         [qw{
256                   - A  I  U  E  O
257                 .>G ガ ギ グ ゲ ゴ
258                 .>Z ザ ジ ズ ゼ ゾ
259                 .>D ダ ヂ ヅ デ ド
260                 .>B バ ビ ブ ベ ボ
261                 .>P パ ピ プ ペ ポ
262                 .>V ヷ ヸ ヴ ヹ ヺ
263         }],
264 ) : (),
265 );
266
267 :></div>
268
269 <div class="legend">
270         <table class="glyphs"><tr>
271         <td class="X di-a">ascii
272         <td class="X di-d">digraph
273         <td class="X di-prop">proposed
274         <td class="X di-b">other unicode
275         <td class="X di-rare">discouraged
276         </table>
277 </div>
278
279 <p class="footer">
280         <a href="/" rel="home">sheet.shiar.nl</a>/unicode.<a href="/source/unicode.plp"
281          rel="code" title="Written in Perl">plp</a>
282         <a href="http://git.shiar.nl/sheet.git/history/HEAD:/unicode.plp"
283          rel="vcs-git" title="Git repository"><:= $VERSION :></a>
284         created by <a href="http://shiar.nl/" rel="author">Shiar</a> •
285         <a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html" rel="copyright"
286          title="Licensed under the GNU Affero General Public License, version 3">AGPLv3</a>
287 </p>
288
289 </html>