4 title => 'digraph cheat sheet',
7 "Complete table of digraph characters from RFC-1345.",
10 digraph mnemonic compose composition pair
11 character char glyph table unicode vim
13 stylesheet => [qw'light'],
14 data => [qw( digraphs.inc.pl )],
18 <h1>RFC-1345 Digraphs</h1>
20 <p>Character mnemonics
21 following composition key ⎄:
22 i^k in <a href="/vi">Vim</a>,
23 ^u^\ in <a href="/readline">Emacs</a>,
24 ^a^v in <a href="/screen">Screen</a>.
25 Also see <a href="/unicode">common Unicode</a>.</p>
27 <p class="aside">Unofficial <span class="u-prop ex">proposals</span>
28 are available as <a href="/digraphs.vim">ex commands</a>.</p>
31 my $di = do 'digraphs.inc.pl'
32 or die "Error loading digraphs data: ", $@ // $!;
35 [qw{! " % ' ( ) * + , - . /}],
36 ['0'..'9'], [qw{: ; < = > ?}],
37 ['A'..'M'], ['N'..'Z'],
38 ['a'..'m'], ['n'..'z'],
40 my @chars2 = (['_'], @chars); # trailing character (extended set)
41 my @columns = !exists $get{split} ? \@chars2 :
42 ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]);
44 if (exists $get{xorg}) {
45 my $xorg = do 'data/digraphs-xorg.inc.pl'
46 or die "Error loading Xorg data: ", $@ // $!;
47 $_ = [ord $_] for values %{$xorg};
48 $xorg->{$_}->[2] = # class = same as rfc | any other spec | xorg only
49 $di->{$_} ? $di->{$_}->[2] =~ /\bu-di\b/ ? 'l5' : 'l3' : 'l1'
51 $chars2[0] = [qw( # ^ _ ` ~ )];
56 for my $colchars (@columns) {
57 print '<table class="glyphs dimap"><col>';
58 print qq'<colgroup span="$_">' for map {scalar @$_} @{$colchars};
59 print "</colgroup><col>\n";
60 for my $section (qw{thead tfoot}) {
61 print "<$section><tr><th>↳";
62 print '<th>', EscapeHTML($_) for map {@$_} @{$colchars};
65 for my $c1group (@chars) {
67 for my $c1 (@$c1group) {
68 print '<tr><th>', EscapeHTML($c1);
69 for my $c2 (map {@$_} @$colchars) {
71 if (not defined $di->{$mnem}) {
75 if (ref $di->{$mnem} ne 'ARRAY') {
76 printf '<td class="X Xr" title="%s">', EscapeHTML($mnem);
79 my ($codepoint, $name, $prop, $script, $string) = @{ $di->{$mnem} };
81 my $glyph = $string || chr $codepoint;
82 utf8::upgrade($glyph); # prevent latin1 output
83 my $desc = $mnem . ($name && " ($name)");
84 my @class = ('X', grep {$_} $prop, $script);
86 $glyph = EscapeHTML($glyph);
87 $glyph = "<span>$glyph</span>" if $script =~ /\bZs\b/;
89 printf "\n".'<td class="%s" title="%s">%s',
90 join(' ', @class), EscapeHTML($desc), $glyph;
92 print "\n<th>", EscapeHTML($c1), "\n";
96 print '<hr>' if exists $get{split};
100 <table class="glyphs"><tr>
101 <td class="X Cc">control
102 <td class="X Zs"><span>space</span>
103 <td class="X Mn">combining
104 <td class="X Sk">spacing modifier
105 <td class="X Pf">quote
106 <td class="X Po">punctuation
107 <td class="X So">symbol
108 <td class="X Sm">math
109 <td class="X Sc">currency
110 <td class="X No">numeric
111 <td class="X Greek">greek
112 <td class="X Cyrillic">cyrillic
113 <td class="X Latin">latin
114 <td class="X Hebrew">hebrew
115 <td class="X Arabic">arabic
116 <td class="X Hangul">korean
117 <td class="X Hiragana">japanese
118 <td class="X Bopomofo">chinese
121 <table class="glyphs"><tr>
122 <td class="X">unicode
123 <td class="X Xl">latin1
124 <td class="X Xa">ascii
125 <td class="X u-prop">vim extension
126 <td class="X u-prop ex">proposal
127 <td class="X ex">not in vim