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