4 title => 'digraph cheat sheet',
7 "Complete table of digraph characters from RFC-1345.",
10 digraph compose character char glyph table unicode vim
12 stylesheet => [qw'light'],
13 data => [qw( digraphs.inc.pl )],
17 <h1>RFC-1345 Digraphs</h1>
19 <p>i^k in <a href="/vi">Vim</a>.
20 Also see <a href="/unicode">common digraphs</a>.</p>
22 <p class="aside">Unofficial <span class="u-prop ex">proposals</span>
23 are available as <a href="/digraphs.vim">ex commands</a>.</p>
26 my $di = do 'digraphs.inc.pl'
27 or die "Error loading digraphs data: ", $@ // $!;
30 [qw{! " % ' ( ) * + , - . /}],
31 ['0'..'9'], [qw{: ; < = > ?}],
32 ['A'..'M'], ['N'..'Z'],
33 ['a'..'m'], ['n'..'z'],
35 my @chars2 = (['_'], @chars); # trailing character (extended set)
36 my @columns = !exists $get{split} ? \@chars2 :
37 ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]);
39 if (exists $get{xorg}) {
40 my $xorg = do 'data/digraphs-xorg.inc.pl'
41 or die "Error loading Xorg data: ", $@ // $!;
42 $_ = [ord $_] for values %{$xorg};
43 $xorg->{$_}->[2] = # class = same as rfc | any other spec | xorg only
44 $di->{$_} ? $di->{$_}->[2] =~ /\bu-di\b/ ? 'l5' : 'l3' : 'l1'
46 $chars2[0] = [qw( # ^ _ ` ~ )];
51 for my $colchars (@columns) {
52 print '<table class="glyphs dimap"><col>';
53 print qq'<colgroup span="$_">' for map {scalar @$_} @{$colchars};
54 print "</colgroup><col>\n";
55 for my $section (qw{thead tfoot}) {
56 print "<$section><tr><th>↳";
57 print '<th>', EscapeHTML($_) for map {@$_} @{$colchars};
60 for my $c1group (@chars) {
62 for my $c1 (@$c1group) {
63 print '<tr><th>', EscapeHTML($c1);
64 for my $c2 (map {@$_} @$colchars) {
66 if (not defined $di->{$mnem}) {
70 if (ref $di->{$mnem} ne 'ARRAY') {
71 printf '<td class="X Xr" title="%s">', EscapeHTML($mnem);
74 my ($codepoint, $name, $prop, $script, $string) = @{ $di->{$mnem} };
76 my $glyph = $string || chr $codepoint;
77 utf8::upgrade($glyph); # prevent latin1 output
78 my $desc = $mnem . ($name && " ($name)");
79 my @class = ('X', grep {$_} $prop, $script);
81 $glyph = EscapeHTML($glyph);
82 $glyph = "<span>$glyph</span>" if $script =~ /\bZs\b/;
84 printf "\n".'<td class="%s" title="%s">%s',
85 join(' ', @class), EscapeHTML($desc), $glyph;
87 print "\n<th>", EscapeHTML($c1), "\n";
91 print '<hr>' if exists $get{split};
95 <table class="glyphs"><tr>
96 <td class="X Cc">control
97 <td class="X Zs"><span>space</span>
98 <td class="X Mn">combining
99 <td class="X Sk">spacing modifier
100 <td class="X Pf">quote
101 <td class="X Po">punctuation
102 <td class="X So">symbol
103 <td class="X Sm">math
104 <td class="X Sc">currency
105 <td class="X No">numeric
106 <td class="X Greek">greek
107 <td class="X Cyrillic">cyrillic
108 <td class="X Latin">latin
109 <td class="X Hebrew">hebrew
110 <td class="X Arabic">arabic
111 <td class="X Hangul">korean
112 <td class="X Hiragana">japanese
113 <td class="X Bopomofo">chinese
116 <table class="glyphs"><tr>
117 <td class="X">unicode
118 <td class="X Xl">latin1
119 <td class="X Xa">ascii
120 <td class="X u-prop">vim extension
121 <td class="X u-prop ex">proposal
122 <td class="X ex">not in vim