digraphs: ipa character proposals
[sheet.git] / unicode.plp
1 <:
2 use utf8;
3 use strict;
4 use warnings;
5 use open IO => ':utf8';
6
7 our $VERSION = '1.0';
8
9 $header{content_type} = 'text/html; charset=utf-8';
10
11 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
12  "http://www.w3.org/TR/html4/loose.dtd">
13 <html>
14
15 <head>
16 <title>digraph cheat sheet</title>
17 <meta http-equiv="content-type" content="utf-8">
18 <link rel="stylesheet" type="text/css" media="all" href="/digraphs.css">
19 <style>
20 table {
21         margin: 1ex 1ex 2ex;
22         float: left;
23         table-layout: auto;
24 }
25 thead td {
26         width: auto;
27 }
28 tbody {
29         border-width: 0;
30 }
31 h2, h3 {
32         clear: both;
33 }
34
35 th {
36         text-align: left;
37         font-size: 50%;
38         background: #888;
39         color: #FFF;
40         padding: 0 0.2em;
41 }
42 thead td {
43         border: 0;
44 }
45
46 td {
47         background: transparent;
48         vertical-align: top;
49         margin: 0;
50         padding: 0;
51 }
52 small {
53         font-size: 50%;
54         display: block;
55         width: 3.2em;
56         background: #888;
57         color: #FFF;
58 }
59
60 td.empty {
61         background: #DDD;
62 }
63 td.reserved {
64         background: #BBB;
65 }
66 </style>
67 </head>
68
69 <body>
70 <h1>Common Digraphs</h1>
71
72 <p>i^k in <a href="/">Vim</a>.
73 Also see the <a href="/digraphs">complete digraphs table</a>.</p>
74
75 <:
76 my $diinfo = do 'digraphs.inc.pl';
77 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
78         keys %$diinfo;
79
80 sub quote {
81         local $_ = shift;
82         s/"/&quot;/g;
83         s/</&lt;/g;
84         s/>/&gt;/g;
85         return $_;
86 }
87
88 sub table {
89         my ($width, $digraphs, $rowheads, $colheads) = @_;
90
91         my @cells;
92         push @cells, sprintf '<td title="%s"%s>%s%s',
93                 $di{ord $_} && $diinfo->{$di{ord $_}}->[1],
94                 $_ eq '-' ? ' class="empty"' : $_ eq '=' ? ' class="reserved"' : '',
95                 $_ eq '-' || $_ eq '=' ? '&nbsp;' : quote($_),
96                 $di{ord $_} && sprintf(' <small>%s</small>', $di{ord $_})
97                         for @$digraphs;
98
99         if ($rowheads) {
100                 splice @cells, $_ * $width, 0, '<th>'.($rowheads->[$_] || '&nbsp;')
101                         for reverse 0 .. $#cells / $width;
102                 $width++;
103         }
104
105         my @rows;
106         push @rows, sprintf '<tr>%s', join '', splice @cells, 0, $width, ()
107                 while @cells;
108
109         if ($colheads) {
110                 unshift @rows, sprintf '<thead><tr><td>%s<tbody>', join '',
111                         map { sprintf '<th title="%2$s">%s', split(/:/, $colheads->[$_], 2) }
112                         0 .. $width-2;
113         }
114
115         return sprintf "<table>%s</table>\n", join '', @rows;
116 }
117
118 print "<h2>Arrows</h2>\n\n";
119 print table(@$_) for (
120         [ 4 => [qw{↖ ↑ ↗ ↔  ← - → ↕  ↙ ↓ ↘ -}]],
121         [ 4 => [qw{⇖ ⇑ ⇗ ⇔  ⇐ - ⇒ ⇕  ⇘ ⇓ ⇙ -}]],
122         [ 3 => [qw{◤ ▲ ◥  ◀ ◆ ▶  ◣ ▼ ◢}]],
123         [ 3 => [qw{◸ △ ◹  ◁ ◇ ▷  ◺ ▽ ◿}]],
124 );
125
126 print "<h2>Line drawing</h2>\n\n";
127 print table(@$_) for (
128         [ 4 => [qw{┌ ┬ ┐ ─  ├ ┼ ┤ │  └ ┴ ┘ -}]],
129         [ 4 => [qw{┏ ┳ ┓ ━  ┣ ╋ ┫ ┃  ┗ ┻ ┛ -}]],
130         [ 3 => [qw{┍ ┯ ┑  ┝ ┿ ┥  ┕ ┷ ┙}]],
131         [ 3 => [qw{┎ ┰ ┒  ┠ ╂ ┨  ┖ ┸ ┚}]],
132 #       [ 4 => [qw{╔ ╦ ╗ ═  ╠ ╬ ╣ ║  ╚ ╩ ╝ -}]],
133 #       [ 3 => [qw{╒ ╤ ╕  ╞ ╪ ╡  ╘ ╧ ╛}]],
134 #       [ 3 => [qw{╓ ╥ ╖  ╟ ╫ ╢  ╙ ╨ ╜}]],
135 );
136
137 print "<h2>Signs</h2>\n\n";
138 print table(@$_) for (
139         [ 3 => [qw{▘ ▀ ▝  ▌ █ ▐  ▖ ▄ ▗  ░ ▒ ▓}]],
140         [ 3 => [qw{□ ▣ ■  ▤ ▦ ▥  ▧ ▩ ▨}]],
141         [ 4 => [qw{♠ ♡ ♢ ♣  ♤ ♥ ♦ ♧}]],
142         [10 => [qw{☼ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}]],  # solar
143 #       [12 => [qw{♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}]],  # zodiac
144         [ 8 => [qw{¤ ¢ ₥ € £ ₨ $ ¥  ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}]],
145 );
146
147 print "<h2>IPA</h2>\n\n";
148 print table(@$_) for (
149         [
150                 12 => [qw{
151                         p t - ʈ - c k q - = ʡ ʔ
152                         b d - ɖ - ɟ ɡ ɢ - = - =
153                         m ɱ - n - ɳ ɲ ŋ ɴ = = =
154                         ʙ - - r - - - = ʀ = я =
155                         - ⱱ - ɾ - ɽ - = ɢ̆ = - =
156                         ɸ f θ s ʃ ʂ ç x χ ħ ʜ h
157                         β v ð z ʒ ʐ ʝ ɣ ʁ ʕ ʢ ɦ
158                         = = - ɬ - - - - - = = =
159                         = = - ɮ - - - - - = = =
160                         - ʋ - ɹ - ɻ j ɰ - - - =
161                         = = - l - ɭ ʎ ʟ - = = =
162                         ʘ - ǀ ǁ ǃ - ǂ - - = = =
163                         ɓ - ɗ - - - ʄ ɠ ʛ - - -
164                 }],
165                 [
166                         'Plosive',
167                         'Voiced plosive',
168                         'Nasal',
169                         'Trill',
170                         'Tap/flap',
171                         'Fricative',
172                         'Voiced fricative',
173                         'Lateral fricative',
174                         'Voiced lateral fricative',
175                         'Approximant',
176                         'Lateral approximant',
177                         'Click',
178                         'Implosive',
179                 ],
180                 [
181                         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',
182                 ],
183         ],
184         [
185                 6 => [qw{
186                         i y  ɨ ʉ  ɯ u
187                         - ɪ  ʏ -  ʊ -
188                         e ø  ɘ ɵ  ɤ o
189                         - -  ə -  - -
190                         ɛ œ  ɜ ɞ  ʌ ɔ
191                         æ -  ɐ -  - -
192                         a ɶ  - -  ɑ ɒ
193                 }],
194                 [qw{Close Near-close Close-mid Mid Open-mid Near-open Open}],
195                 [map {substr($_, 0, 1).':'.$_, substr($_, 0, 1)." r:$_ rounded"} qw{Front Central Back}]
196         ],
197 );
198