digraphs: fix mouse pointer on legend hover
[sheet.git] / digraphs.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 </head>
20
21 <body>
22 <h1>RFC-1345 Digraphs</h1>
23
24 <:
25 my $di = do 'digraphs.inc.pl';
26
27 sub quote {
28         local $_ = shift;
29         s/"/&quot;/g;
30         s/</&lt;/g;
31         s/>/&gt;/g;
32         return $_;
33 }
34
35 my @chars = (
36         [qw{! " % ' ( ) * + , - . /}],
37         ['0'..'9'], [qw{: ; < = > ?}],
38         ['A'..'M'], ['N'..'Z'],
39         ['a'..'m'], ['n'..'z'],
40 );
41 my @chars2 = (@chars, ['_']);  # trailing character (extended set)
42
43 print '<table><col>';
44 print qq'<colgroup span="$_">' for map {scalar @$_} @chars2;
45 print "\n";
46 for my $section (qw{thead tfoot}) {
47         print "<$section><tr><th>&nbsp;";
48         print "<th>$_" for map {@$_} @chars2;
49 }
50 for my $c1group (@chars) {
51         print '<tbody>';
52         for my $c1 (@$c1group) {
53                 print "<tr><th>$c1";
54                 for my $c2 (map {@$_} @chars2) {
55                         my $mnem = $c1 . $c2;
56                         if (not defined $di->{$mnem}) {
57                                 print '<td>';
58                                 next;
59                         }
60                         my ($codepoint, $name, $prop, $script) = @{ $di->{$mnem} };
61
62                         my $glyph = chr $codepoint;
63                         utf8::upgrade($glyph);  # prevent latin1 output
64                         my $desc = $mnem . ($name && " ($name)");
65                         my @class = ('X', grep {$_} $prop, $script);
66
67                         $glyph = quote($glyph);
68                         $glyph = "<span>$glyph</span>" if $prop eq 'Zs';
69
70                         printf "\n".'<td class="%s" title="%s">%s',
71                                 join(' ', @class), quote($desc), $glyph;
72                 }
73                 print "\n<th>$c1\n";
74         }
75 }
76 print "</table>\n";
77 :>
78 <div id="legend">
79         <table><tr>
80         <td class="X Cc">control
81         <td class="X Zs"><span>spacing</span>
82         <td class="X Mn">modifier
83         <td class="X Sk">spacing modifier
84         <td class="X Pf">quote
85         <td class="X Po">punctuation
86         <td class="X So">symbol
87         <td class="X Sm">math
88         <td class="X Sc">currency
89         <td class="X No">numeric
90         <td class="X Greek">greek
91         <td class="X Cyrillic">cyrillic
92         <td class="X Latin">latin
93         <td class="X Hebrew">hebrew
94         <td class="X Arabic">arabic
95         <td class="X Hiragana">japanese
96         <td class="X Bopomofo">chinese
97         </table>
98
99         <table><tr>
100         <td class="X">unicode
101         <td class="X Xl">latin1
102         <td class="X Xa">ascii
103         <td class="X Co">private
104         <td class="X Xz">proposed
105         </table>
106 </div>
107
108 <p id="footer">
109         <a href="http://vi.shiar.net/digraphs">vi.<strong>shiar.net</strong>/digraphs</a>
110         <a href="git://dev.shiar.net/vi-cheat"><:= "v$VERSION" :></a>
111         created by Shiar •
112         <a title="Licensed under the GNU Affero General Public License, version 3"
113            href="http://www.fsf.org/licensing/licenses/agpl-3.0.html">AGPLv3</a> •
114         last update <:
115                 use Time::Format qw(time_format);
116                 print time_format('yyyy-mm-dd', (stat 'digraphs.inc.pl')[9]);
117         :>
118 </p>
119
120 </html>