rewrite extensionless script requests
[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 = ((map {chr} ord '!' .. ord 'Z'), 'a'..'z');
36 splice @chars, $_, 1, () for 2, 3-1, 5-2, 31-3;  # remove character exceptions # $ & @
37 my @chars2 = (@chars, '_');  # trailing character (extended set)
38
39 print '<table>';
40 for my $section (qw{thead tfoot}) {
41         print "<$section><tr><th>&nbsp;";
42         print "<th>$_" for @chars2;
43 }
44 print '<tbody>';
45 for my $c1 (@chars) {
46         print "<tr><th>$c1";
47         for my $c2 (@chars2) {
48                 my $mnem = $c1 . $c2;
49                 if (not defined $di->{$mnem}) {
50                         print '<td>';
51                         next;
52                 }
53                 my ($codepoint, $name, $prop, $script) = @{ $di->{$mnem} };
54
55                 my $glyph = chr $codepoint;
56                 utf8::upgrade($glyph);  # prevent latin1 output
57                 my $desc = $mnem . ($name && " ($name)");
58                 my @class = ('X', grep {$_} $prop, $script);
59
60                 $glyph = quote($glyph);
61                 $glyph = "<span>$glyph</span>" if $prop eq 'Zs';
62
63                 printf "\n".'<td class="%s" title="%s">%s',
64                         join(' ', @class), quote($desc), $glyph;
65         }
66         print "\n<th>$c1\n";
67 }
68 print "</table>\n";
69 :>
70 <div id="legend">
71         <table><tr>
72         <td class="X Cc">control
73         <td class="X Zs"><span>spacing</span>
74         <td class="X Mn">modifier
75         <td class="X Sk">spacing modifier
76         <td class="X Pf">quote
77         <td class="X Po">punctuation
78         <td class="X So">symbol
79         <td class="X Sm">math
80         <td class="X Sc">currency
81         <td class="X No">numeric
82         <td class="X Greek">greek
83         <td class="X Cyrillic">cyrillic
84         <td class="X Latin">latin
85         <td class="X Hebrew">hebrew
86         <td class="X Arabic">arabic
87         <td class="X Hiragana">japanese
88         <td class="X Bopomofo">chinese
89         </table>
90
91         <table><tr>
92         <td class="X">unicode
93         <td class="X Xl">latin1
94         <td class="X Xa">ascii
95         <td class="X Co">private
96         <td class="X Xz">proposed
97         </table>
98 </div>
99
100 </html>