link back and forth between digraphs and unicode pages
[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 td {
25         border: 1px solid #888;
26         text-align: center;
27         vertical-align: top;
28         margin: 0;
29         padding: 0;
30 }
31 small {
32         font-size: 50%;
33         display: block;
34         width: 3em;
35         background: #888;
36         color: #FFF;
37 }
38 </style>
39 </head>
40
41 <body>
42 <h1>Common Digraphs</h1>
43
44 <p>i^k in <a href="/">Vim</a>.
45 Also see the <a href="/digraphs">complete digraphs table</a>.</p>
46
47 <:
48 my $diinfo = do 'digraphs.inc.pl';
49 my %di = map { $diinfo->{$_}->[0] => $_ } grep { ref $diinfo->{$_} }
50         keys %$diinfo;
51
52 sub quote {
53         local $_ = shift;
54         s/"/&quot;/g;
55         s/</&lt;/g;
56         s/>/&gt;/g;
57         return $_;
58 }
59
60 sub table {
61         my ($width, $digraphs) = @_;
62
63         my @cells;
64         push @cells, sprintf '<td title="%s">%s%s',
65                 $di{ord $_} && $diinfo->{$di{ord $_}}->[1],
66                 $_ eq '-' ? '&nbsp;' : quote($_),
67                 $di{ord $_} && sprintf(' <small>%s</small>', $di{ord $_})
68                         for @$digraphs;
69
70         my @rows;
71         push @rows, sprintf '<tr>%s', join '', splice @cells, 0, $width, ()
72                 while @cells;
73
74         return sprintf "<table>%s</table>\n", join '', @rows;
75 }
76
77 print "<h2>Arrows</h2>\n\n";
78 print table(@$_) for (
79         [ 4 => [qw{↖ ↑ ↗ ↔  ← - → ↕  ↙ ↓ ↘ -}]],
80         [ 4 => [qw{⇖ ⇑ ⇗ ⇔  ⇐ - ⇒ ⇕  ⇘ ⇓ ⇙ -}]],
81         [ 3 => [qw{◤ ▲ ◥  ◀ ◆ ▶  ◣ ▼ ◢}]],
82         [ 3 => [qw{◸ △ ◹  ◁ ◇ ▷  ◺ ▽ ◿}]],
83 );
84
85 print "<h2>Line drawing</h2>\n\n";
86 print table(@$_) for (
87         [ 4 => [qw{┌ ┬ ┐ ─  ├ ┼ ┤ │  └ ┴ ┘ -}]],
88         [ 4 => [qw{┏ ┳ ┓ ━  ┣ ╋ ┫ ┃  ┗ ┻ ┛ -}]],
89         [ 3 => [qw{┍ ┯ ┑  ┝ ┿ ┥  ┕ ┷ ┙}]],
90         [ 3 => [qw{┎ ┰ ┒  ┠ ╂ ┨  ┖ ┸ ┚}]],
91 #       [ 4 => [qw{╔ ╦ ╗ ═  ╠ ╬ ╣ ║  ╚ ╩ ╝ -}]],
92 #       [ 3 => [qw{╒ ╤ ╕  ╞ ╪ ╡  ╘ ╧ ╛}]],
93 #       [ 3 => [qw{╓ ╥ ╖  ╟ ╫ ╢  ╙ ╨ ╜}]],
94 );
95
96 print "<h2>Signs</h2>\n\n";
97 print table(@$_) for (
98         [ 3 => [qw{▘ ▀ ▝  ▌ █ ▐  ▖ ▄ ▗}]],
99         [ 3 => [qw{░ ▒ ▓  □ ▣ ■  ▤ ▦ ▥  ▧ ▩ ▨}]],
100         [ 4 => [qw{♠ ♡ ♢ ♣  ♤ ♥ ♦ ♧}]],
101         [10 => [qw{☼ ☿ ♀ ♁ ♂ ♃ ♄ ♅ ♆ ♇}]],  # solar
102 #       [12 => [qw{♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓}]],  # zodiac
103         [ 8 => [qw{¤ ¢ ₥ € £ ₨ $ ¥  ₫ ₭ ₦ ₱ ₧ ₮ ₩ ₪}]],
104 );
105
106 print "<h2>IPA</h2>\n\n";
107 print table(@$_) for (
108         [12 => [qw{
109                 p t - ʈ - c k q - ʔ - ʡ
110                 b d - ɖ - ɟ ɡ ɢ - - - -
111                 m ɱ - n - ɳ ɲ ŋ ɴ - - -
112                 ʙ - - r - - - - - - - -
113                 - ⱱ - ɾ - ɽ - - - - - -
114                 ɸ f θ s ʃ ʂ ç x χ ħ h ʜ
115                 β v ð z ʒ ʐ ʝ ɣ ʁ ʕ ɦ ʢ
116                 - - - ɬ - - - - - - - -
117                 - - - ɮ - - - - - - - -
118                 - ʋ - ɹ - ɻ j ɰ - - - -
119                 - - - l - ɭ ʎ ʟ - - - -
120                 ʘ - ǀ ǁ ǃ - ǂ - - - - -
121                 ɓ - ɗ - - - ʄ ɠ ʛ - - -
122         }]],
123         [6 => [qw{
124                 i y  ɨ ʉ  ɯ u
125                 - ɪ  ʏ -  ʊ -
126                 e ø  ɘ ɵ  ɤ o
127                 - -  ə -  - -
128                 ɛ œ  ɜ ɞ  ʌ ɔ
129                 æ -  ɐ -  - -
130                 a ɶ  - -  ɑ ɒ
131         }]],
132 );
133