7 use open OUT => ':utf8', ':std';
11 # create a hash of desired input
12 my $di = do 'data/digraphs-rfc.inc.pl'
13 or die "error reading digraphs include: ", $@ // $!;
16 my $extra = do 'data/digraphs-shiar.inc.pl'
17 or warn "could not include shiar proposals: ", $@ // $!;
18 my $vim = do 'data/digraphs-vim.inc.pl'
19 or warn "could not include vim extensions ", $@ // $!;
20 $di = { %{$vim // {}}, %{$di}, %{$extra // {}} };
22 # optionally get unicode character information
23 my $uninfo = do 'unicode-char.inc.pl'
24 or warn "could not include unicode details: ", $@ // $!;
26 # output perl code of hash
27 # (assume no backslashes or curlies, so we can just q{} w/o escaping)
28 print "# automatically generated by $0\n";
31 printf '(map {$_=>0} qw{%s}),'."\n", join(' ',
32 grep { !defined $di->{$_} }
33 map { substr($_, 1, 1).substr($_, 0, 1) } sort keys %{$di}
35 printf "q{%s}=>[%s],\n", $_, join(',',
36 $di->{$_}, # original code point
38 $uninfo->{ chr $di->{$_} }->[1], # name
39 $uninfo->{ chr $di->{$_} }->[0], # class
40 (map {('', $_)} $uninfo->{ chr $di->{$_} }->[4] // ()), # string
41 ) for sort keys %{$di};
48 mkdigraphlist - Output character list of combined digraph data
52 mkdigraphlist >digraphs.inc.pl
53 perl -e'$di = do "digraphs.inc.pl"; print chr $di->{DO}->[0]'
57 Combines precompiled digraph includes of rfc (1345), vim, and shiar
58 and outputs a complete map including character details and usage classes.
60 The value can either be a scalar string containing another
61 digraph which can be considered identical (usually inverted),
62 or an array ref containing at least the resulting character's
63 Unicode code point value. If available, the following UCD data
64 is appended: character name, category, script, and output string.
68 AE => [198, 'LATIN CAPITAL LETTER AE', 'Lu Xl', 'Latin'],
74 Mischa POSLAWSKY <perl@shiar.org>
78 Licensed under the GNU Affero General Public License version 3.