5 use open IO => ':utf8';
7 use Unicode::UCD qw(charinfo);
11 $header{content_type} = 'text/html; charset=utf-8';
13 :><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
14 "http://www.w3.org/TR/html4/loose.dtd">
18 <title>digraph cheat sheet</title>
19 <meta http-equiv="content-type" content="utf-8">
26 border-collapse: collapse;
27 table-layout: fixed; /* prevent resizing, notably in msie6 */
40 width: 1.2em; /* msie only looks at the first row */
41 min-width: 1em; /* prevents gecko from restricting to page width */
47 border: 1px solid #888;
54 td.Lm, td.Mc, td.Me, td.Zl, td.Zp, td.Cs {background:red} /* unknown */
57 td.Greek {background: #FFE0CF}
58 td.Cyrillic {background: #FFDDA8}
59 td.Latin {background: #FFB}
60 td.Hebrew {background: #FFD}
61 td.Arabic {background: #EFE}
62 td.Hiragana {background: #DFC}
63 td.Katakana {background: #DFA}
64 td.Bopomofo {background: #BFC}
67 td.No {background: #FBB} /* number */
68 td.Sc {background: #FCD} /* currency */
69 td.Sm {background: #ECE} /* math */
70 td.So {background: #DDCCFF} /* symbol */
72 td.Po {background: #CDF} /* punctuation */
74 td.Pf {background: #BEF} /* quote */
76 td.Sk {background: #CEE} /* spacing modifier */
77 td.Mn {background: #ACC} /* modifier */
78 td.Cc {background: #BBB; color: #666} /* control */
79 td.Zs {background: #ACB} /* space */
80 td.Zs span {background: #EEE}
82 td.Xa {color: #040} /* ascii */
83 td.Xl {color: #080} /* latin1 */
84 td.Co {color: #800} /* private */
85 td.Xz {color: #F00} /* proposed */
94 <h1>RFC-1345 Digraphs</h1>
97 my $di = do 'digraphs.inc.pl';
107 my @chars = ((map {chr} ord '!' .. ord 'Z'), 'a'..'z');
108 splice @chars, $_, 1, () for 2, 3-1, 5-2, 31-3; # remove character exceptions # $ & @
109 my @chars2 = (@chars, '_'); # trailing character (extended set)
112 for my $section (qw{thead tfoot}) {
113 print "<$section><tr><th> ";
114 print "<th>$_" for @chars2;
117 for my $c1 (@chars) {
119 for my $c2 (@chars2) {
120 my $mnem = $c1 . $c2;
121 if (not defined $di->{$mnem}) {
125 my $chr = $di->{$mnem};
126 my $glyph = chr $chr;
127 utf8::upgrade($glyph); # prevent latin1 output
128 my $info = charinfo($chr);
131 $desc .= " ($_)" for $info->{name} || ();
134 push @class, $_ for $info->{category} || ();
135 push @class, $_ for $info->{script} || ();
137 $glyph = quote($glyph);
138 $glyph = "<span>$glyph</span>" if $info->{category} eq 'Zs';
140 printf "\n".'<td class="%s" title="%s">%s',
141 join(' ', @class), quote($desc), $glyph;
149 <td class="X Cc">control
150 <td class="X Zs"><span>spacing</span>
151 <td class="X Mn">modifier
152 <td class="X Sk">spacing modifier
153 <td class="X Pf">quote
154 <td class="X Po">punctuation
155 <td class="X So">symbol
156 <td class="X Sm">math
157 <td class="X Sc">currency
158 <td class="X No">numeric
159 <td class="X Greek">greek
160 <td class="X Cyrillic">cyrillic
161 <td class="X Latin">latin
162 <td class="X Hebrew">hebrew
163 <td class="X Arabic">arabic
164 <td class="X Hiragana">japanese
165 <td class="X Bopomofo">chinese
169 <td class="X">unicode
170 <td class="X Xa">ascii
171 <td class="X Xl">latin1
172 <td class="X Co">private
173 <td class="X Xz">proposed