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