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