Source of digraphs.xcompose.plp
<:
use 5.020;
use warnings;
use utf8;
use open ':std' => ':utf8';
use feature 'signatures';
use JSON;
our $VERSION = 'v1.0';
$header{content_type} = 'text/plain; charset=utf-8';
$header{'Content-Disposition'} = 'inline; filename=".XCompose"';
say '# .XCompose sequences of extended vim digraphs <https://sheet.shiar.nl/digraphs>';
say '';
sub Data($filename) {
return eval {
open my $cache, '<:raw', "data/$filename.json" or die $!;
local $/;
return JSON::decode_json(readline $cache);
} or do {
say "# SERVER ERROR! $!; try again later";
warn $!;
exit;
};
}
my $di = Data('digraphs');
my $symnames = Data('keysymdef');
my %sym = reverse $symnames->%*;
for my $mnem (sort keys $di->{key}->%*) {
my $res = $di->{key}->{$mnem};
$res ||= $di->{key}->{reverse split //, $mnem} or next;
my ($cp, $name) = $res->@*;
$cp or next;
my $glyph = $cp < 32 ? sprintf('\%03o', $cp) : chr($cp);
print '<Multi_key>';
printf " <%s>", $sym{$_} // $_ for split //, $mnem;
printf ' : "%s" U%04X # %s', $glyph, $cp, $name;
say '';
}