unicode: copy glyph to clipboard on cell click
[sheet.git] / digraphs.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'digraph cheat sheet',
5         version => 'v1.0',
6         description => [
7                 "Complete table of digraph characters from RFC-1345.",
8         ],
9         keywords => [qw'
10                 digraph compose character char glyph table unicode vim
11         '],
12         stylesheet => [qw'light'],
13 });
14
15 :>
16 <h1>RFC-1345 Digraphs</h1>
17
18 <p>i^k in <a href="/">Vim</a>.
19 Also see <a href="/unicode">common digraphs</a>.</p>
20
21 <p class="aside">Unofficial <span class="Xz">proposals</span>
22 are available as <a href="/digraphs.vim">ex commands</a>.</p>
23
24 <:
25 my $di = do 'digraphs.inc.pl';
26
27 my @chars = (
28         [qw{! " % ' ( ) * + , - . /}],
29         ['0'..'9'], [qw{: ; < = > ?}],
30         ['A'..'M'], ['N'..'Z'],
31         ['a'..'m'], ['n'..'z'],
32 );
33 my @chars2 = (['_'], @chars);  # trailing character (extended set)
34
35 print '<table class="glyphs dimap"><col>';
36 print qq'<colgroup span="$_">' for map {scalar @$_} @chars2;
37 print "</colgroup><col>\n";
38 for my $section (qw{thead tfoot}) {
39         print "<$section><tr><th>↳";
40         print '<th>', EscapeHTML($_) for map {@$_} @chars2;
41         print "<th>&nbsp;\n";
42 }
43 for my $c1group (@chars) {
44         print '<tbody>';
45         for my $c1 (@$c1group) {
46                 print '<tr><th>', EscapeHTML($c1);
47                 for my $c2 (map {@$_} @chars2) {
48                         my $mnem = $c1 . $c2;
49                         if (not defined $di->{$mnem}) {
50                                 print '<td>';
51                                 next;
52                         }
53                         if (ref $di->{$mnem} ne 'ARRAY') {
54                                 printf '<td class="X Xr" title="%s">', EscapeHTML($mnem);
55                                 next;
56                         }
57                         my ($codepoint, $name, $prop, $script, $string) = @{ $di->{$mnem} };
58
59                         my $glyph = $string || chr $codepoint;
60                         utf8::upgrade($glyph);  # prevent latin1 output
61                         my $desc = $mnem . ($name && " ($name)");
62                         my @class = ('X', grep {$_} $prop, $script);
63
64                         $glyph = EscapeHTML($glyph);
65                         $glyph = "<span>$glyph</span>" if $prop eq 'Zs';
66
67                         printf "\n".'<td class="%s" title="%s">%s',
68                                 join(' ', @class), EscapeHTML($desc), $glyph;
69                 }
70                 print "\n<th>", EscapeHTML($c1), "\n";
71         }
72 }
73 print "</table>\n";
74 :>
75 <div class="legend">
76         <table class="glyphs"><tr>
77         <td class="X Cc">control
78         <td class="X Zs"><span>spacing</span>
79         <td class="X Mn">modifier
80         <td class="X Sk">spacing modifier
81         <td class="X Pf">quote
82         <td class="X Po">punctuation
83         <td class="X So">symbol
84         <td class="X Sm">math
85         <td class="X Sc">currency
86         <td class="X No">numeric
87         <td class="X Greek">greek
88         <td class="X Cyrillic">cyrillic
89         <td class="X Latin">latin
90         <td class="X Hebrew">hebrew
91         <td class="X Arabic">arabic
92         <td class="X Hangul">korean
93         <td class="X Hiragana">japanese
94         <td class="X Bopomofo">chinese
95         </table>
96
97         <table class="glyphs"><tr>
98         <td class="X">unicode
99         <td class="X Xl">latin1
100         <td class="X Xa">ascii
101         <td class="X Xz">proposed
102         </table>
103 </div>
104