word/%.min.js: word/%.js
uglifyjs -m '' $< -o $@
-data: data/digraphs.json data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.json data/unicode-sampler word
+data: data/digraphs.json data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.json data/unicode-sampler word keyboard/symbols/unigraph
data/DerivedAge.txt: $(download)
tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@
data/digraphs-xorg.json: tools/mkdigraphs-xorg data/xorg-compose data/keysymdef.json
$(call cmdsave,$^)
+keyboard/symbols/%: tools/mkxkbsymbols data/keyboard/altgr/%.eng.json
+ $(call cmdsave,$^)
+
data/digraphs-vim.inc.pl: tools/mkdigraphs-vim
$(call cmdsave,$<)
),
'Inspired by <a href="/keyboard/altgr/msx-graph">MSX graph</a> mode,',
'but reimagined for modern Unicode coverage.',
+ 'Freely available as <a href="/keyboard/symbols/unigraph">xorg symbols</a> export.',
),
moderows => '5421',
flag => {
--- /dev/null
+#!/usr/bin/env perl
+use 5.014;
+use warnings;
+use utf8;
+
+use JSON ();
+
+our $VERSION = '1.00';
+
+my $info = eval {
+ local $/;
+ return JSON->new->utf8->decode(readline);
+} or die "Could not read keyboard layout data: $@\n";
+
+my $geochar = do './keyspos.inc.pl'
+ or die "Could not read keyboard position names: $@\n";
+
+if (($info->{moderows} // '') =~ /4/) {
+ push @{$_}, map {"+$_"} @{$_} for values %{$geochar};
+}
+
+my ($name) = $ARGV =~ m{.*/([^.]+)};
+say "// setxkbmap -print $name | xkbcomp -w0 -I.. - \$DISPLAY";
+say '';
+
+say sprintf 'xkb_symbols "%s" {', $info->{title};
+for my $k (sort keys %{$geochar}) {
+ printf "\tkey <%s> {[%s]};\n", $k, join(', ',
+ map { !$_ ? 'NoSymbol' : sprintf 'U%04X', ord }
+ map { $info->{key}->{$_} } @{ $geochar->{$k} }
+ );
+}
+say '};';
+
+=head1 NAME
+
+mkxkbsymbols - Export keyboard layout metadata as Xorg symbols
+
+=head1 SYNOPSIS
+
+ tools/mkxkbsymbols data/keyboard/altgr/$NAME.eng.json >$NAME
+ setxkbmap -print $NAME | xkbcomp -w0 -I.. - $DISPLAY
+
+=head1 DESCRIPTION
+
+Converts site includes (back) to I<xkb_symbols> configurations
+compatible with C<xkbcomp> so it can be used in Xorg.
+
+=head1 AUTHOR
+
+Mischa POSLAWSKY <perl@shiar.org>
+
+=head1 LICENSE
+
+Licensed under the GNU Affero General Public License version 3.
+