From c078fd68ec023200994197035b777587946f5fda Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 19 Feb 2024 11:15:32 +0100 Subject: [PATCH 01/16] keyboard/altgr/symbolics: distinguish greek letters from symbols Replace unused mode g5 to split up g6. --- keyboard/altgr/symbolics.eng.inc.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/keyboard/altgr/symbolics.eng.inc.pl b/keyboard/altgr/symbolics.eng.inc.pl index dc6ebcd..b0c3a1e 100644 --- a/keyboard/altgr/symbolics.eng.inc.pl +++ b/keyboard/altgr/symbolics.eng.inc.pl @@ -106,9 +106,17 @@ my %rows = ( '|' => "\x{2309}", ); +my $groups = kbchars(\%rows); +$groups->{flag}->{g5} = [greek => + "a different greek letter not corresponding with latin transcription" +]; +while (my ($key, $chr) = each %rows) { + $groups->{def}->{''}->{$key} =~ s/g6/g5/ if $chr =~ /\A\p{Greek}/; +} + +{ - %{ kbchars(\%rows) }, - version => '1.0', + %{$groups}, + version => '1.1', title => 'US Symbolics', category => 'specialised/greek/xorg', intro => join("\n", -- 2.30.0 From d5673328262606bd06f36fd41f0ec866977db7b2 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 25 Feb 2024 16:24:14 +0100 Subject: [PATCH 02/16] keyboard/altgr/index: hide mode and identical keys in inventory --- keyboard/altgr/index.inc.plp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboard/altgr/index.inc.plp b/keyboard/altgr/index.inc.plp index c47bfeb..d4d8bde 100644 --- a/keyboard/altgr/index.inc.plp +++ b/keyboard/altgr/index.inc.plp @@ -147,7 +147,8 @@ for my $inc (sort { my $keys = Shiar_Sheet::Keyboard->new($table); for my $mode ($keys->{mode} ? sort keys %{ $keys->{mode} } : '') { my %inventory; - $inventory{ s/ (?!ext).*//r }++ for values %{ $keys->{def}{$mode} }; + $inventory{$_}++ for grep { /^g[2-9]/ } map { s/ (?!ext).*//r } + values %{ $keys->{def}{$mode} }; print ''; print "" for $keys->{key}{$mode} =~ s/\s.*//r || (); for my $g (sort keys %inventory) { -- 2.30.0 From 0880539638400df47ab159dfd6f282cd46f9de09 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 29 Feb 2024 02:51:49 +0100 Subject: [PATCH 03/16] =?utf8?q?keyboard/altgr/boyeg:=20letter=20=C9=85=20?= =?utf8?q?similar=20to=20A=20(visually=20and=20phonetically)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Literally a "turned V" but in all other senses just a strokeless A. --- Shiar_Sheet/KeyboardChars.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index b2ee11d..0c5b5e5 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -16,7 +16,7 @@ my $uc = Shiar_Sheet::FormatChar->new; our %unaccent = qw( ⍺ a ⍵ w ∊ E ⍷ E ⍴ r ⍳ i ⍸ i ○ O ⍥ O ⌿ / ⍟ (*) ⊕ (+) - Ʊ U ǝ e Ǝ E ʌ v ɥ h ʘ O ɰ mw ɯ mw Ɯ MW ə @ae Ə @AE + Ʊ U ǝ e Ǝ E ʌ vA Ʌ VA ɥ h ʘ O ɰ mw ɯ mw Ɯ MW ə @ae Ə @AE ɸ PF ʎ yl ɔ co Ɔ CO ɛ 3E ƣ q Ƣ Q ∀ A ∃ E ∪ u ∩ n ≠ != ≈ =~ ∅ /0 ∘ o ⋅ . ∫ s ≝ =d ″ " ≤ < ≥ > √ rV ∛ 3V ∜ 4V Α A Β B Γ G Δ D Ε E Ζ Z Η H Θ CQ Ι I Κ K Λ L Μ M -- 2.30.0 From c72d9fce2dae5b7d1e443f30b1abfddb352eabde Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 5 Mar 2024 18:14:27 +0100 Subject: [PATCH 04/16] keyboard/altgr: ignore partial decomposition as accented flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Prevent fractions such as ¾ (3/4) from matching either 3 or 4 in eurkey and msx-graph. No changes otherwise. --- Shiar_Sheet/KeyboardChars.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index 0c5b5e5..d0e84c8 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -55,7 +55,7 @@ sub kbmodes ($modes) { my $class = ( !defined $v || $c eq $v ? 'no' # identical : $v =~ /\A\p{Mn}+\z/ ? 'g9' # combining accent - : NFKD($v) =~ /\Q$c/ ? 'g2' # decomposed equivalent + : NFKD($v) =~ /\A\Q$c\E\p{Mn}*\z/ ? 'g2' # decomposed equivalent : unidecode($v) =~ /\Q$c\E+/i ? 'g4' # transliterated : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 'g8' # modifier symbol : $v =~ /\A[\pM\pP]+\z/ ? 'g7' # mark -- 2.30.0 From 973451ff27debd3dcc2ccd4c9c26a08aceb39e4c Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 2 Mar 2024 23:28:17 +0100 Subject: [PATCH 05/16] keyboard/altgr: msx-graph mode counterpart to msx code --- keyboard/altgr/msx-graph.eng.inc.pl | 158 ++++++++++++++++++++++++++++ keyboard/altgr/msx.eng.inc.pl | 10 +- 2 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 keyboard/altgr/msx-graph.eng.inc.pl diff --git a/keyboard/altgr/msx-graph.eng.inc.pl b/keyboard/altgr/msx-graph.eng.inc.pl new file mode 100644 index 0000000..3bcf5d1 --- /dev/null +++ b/keyboard/altgr/msx-graph.eng.inc.pl @@ -0,0 +1,158 @@ +use utf8; +use strict; +use warnings; +use Shiar_Sheet::KeyboardChars 'kbchars'; +our %get; + +my %rows = ( + '1' => '¼', + '@' => '²', + '2' => '½', + '#' => 'ⁿ', + '3' => '¾', + '4' => '∩', + '5' => '‰', + '^' => '⌡', + '6' => '⌠', + '7' => '√', + '8' => '∞', + '(' => '◘', # inverted · + '9' => '·', # smaller than • + ')' => '◙', + '0' => '○', + '_' => '🮯', + '-' => '─', + '+' => '≡', + '=' => '±', + '~' => '≈', + '`' => '∽', + + 'Q' => '🮙', + 'q' => '🮘', + 'W' => '🭮', + 'w' => '🭬', + 'E' => '🭯', + 'e' => '🭭', + 'R' => '⌐', + 'r' => '┌', + 't' => '┬', + 'Y' => '¬', + 'y' => '┐', + 'U' => '🮅', + 'u' => '▂', + 'I' => '▀', + 'i' => '▄', + 'O' => '🮂', + 'o' => '▆', + 'P' => '🮖', + 'p' => '█', + '[' => '☺', + '{' => '☻', + ']' => '♪', + '}' => '♫', + + 'A' => '▮', + 'a' => '▬', + 'S' => '🮚', + 's' => '🮛', + 'D' => '▚', + 'd' => '▞', + 'F' => '▗', + 'f' => '├', + 'G' => '⟊', # ┼ without connecting right + 'g' => '┼', + 'H' => '▖', + 'h' => '┤', + 'J' => '🮊', + 'j' => '▎', + 'K' => '▐', + 'k' => '▌', + 'L' => '🮇', + 'l' => '▊', + '"' => '♥', + "'" => '♣', + ':' => '♦', + ';' => '♠', + '|' => '│', + '\\'=> '╲', + + 'Z' => '◦', # small white circle + 'z' => '☼', + 'X' => '•', # small black circle + 'x' => '╳', + 'C' => '⁃', + 'c' => '◇', # ◊ + 'V' => '▝', + 'v' => '└', + 'B' => '▬', + 'b' => '┴', + 'N' => '▘', + 'n' => '┘', + 'M' => '♀', + 'm' => '♂', + '<' => '«', + ',' => '≤', + '>' => '»', + '.' => '≥', + '?' => '÷', + '/' => '╱', + +); + +my %compat = ( + 'Q' => '▨', + 'q' => '▧', + 'W' => '◀', # + 'w' => '▶', + 'E' => '▲', + 'e' => '▼', # + 'U' => '▓', + 'J' => '░', + 'O' => '▔', + 'P' => '▒', + 'S' => '⧗', + 's' => '⧓', + 'G' => '╂', + '_' => '┿', + 'L' => '▕', +); + +if (exists $get{compat}) { + %rows = (%rows, %compat); +} + +my $groups = kbchars(\%rows); + +# replace rare punctuation distinctions by symbols +$groups->{def}{''}{$_} =~ s/g[78]/g6/ for keys %rows; + +$groups->{def}{''}{$_} = 'g7' + for grep { $rows{$_} =~ /[\x{2500}-\x{259F}]/ } keys %rows; +$groups->{flag}{g7} = ['drawing', 'box drawing or block elements']; + +$groups->{def}{''}{$_} = 'g8' for keys %compat; # mostly U+1FBxx +$groups->{flag}{g8} = ['legacy', + 'drawing symbols best represented by Unicode 13.0' + . (exists $get{compat} && ', converted to compatible equivalents') +]; + ++{ + %{ $groups }, + version => '1.0', + title => 'MSX graph', + category => 'legacy/msx', + intro => join("\n", + 'Resulting selection', + 'of equivalent Unicode characters', + "when the graph key is pressed on an MSX home computer", + "(International model such as Toshiba HX10 or Phillips NMS 8245).", + 'See also letters and symbols', + "from pressing code.", + ), + description => [ + "MSX keyboard layout table", + "with the graph modifier key.", + ], + image => 'data/keyboard/thumb/msxgraph.jpg', + imagealt => 'Graph key on a Toshiba HX10 with graph labels', +} diff --git a/keyboard/altgr/msx.eng.inc.pl b/keyboard/altgr/msx.eng.inc.pl index ec8e556..a7d8c0b 100644 --- a/keyboard/altgr/msx.eng.inc.pl +++ b/keyboard/altgr/msx.eng.inc.pl @@ -96,14 +96,16 @@ $groups->{flag}{ext} = ['anachrone', 'expected uppercase variants if allowed by +{ %{ $groups }, - version => '1.1', + version => '1.2', title => 'MSX code', - category => 'legacy/latin', + category => 'legacy/msx/latin', intro => join("\n", - 'Resulting selection", - "of equivalent Unicode characters', + 'Resulting selection', + 'of equivalent Unicode characters', "when the code key is pressed on an MSX home computer", "(International model such as Toshiba HX10 or Phillips NMS 8245).", + 'See also block graphics', + "from pressing graph.", ), description => [ "MSX keyboard layout table", -- 2.30.0 From e5a6d30b2cf44f7791d2cef79f8d08da3891f79d Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 3 Mar 2024 03:13:38 +0100 Subject: [PATCH 06/16] keyboard/altgr: emojiworks collection of emoji No longer available at http://emojiworks.co but transcribed from photo at https://www.engadget.com/2015-11-04-hardware-emoji-keyboard-emojiworks.html mostly as a historic curiosity rather than practical aid. --- base.css | 1 + keyboard/altgr/emojiworks.eng.inc.pl | 99 ++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 keyboard/altgr/emojiworks.eng.inc.pl diff --git a/base.css b/base.css index 52a97e5..b0f7312 100644 --- a/base.css +++ b/base.css @@ -283,6 +283,7 @@ dl.legend dt, line-height: 2.25ex; } .keys.big.cmp td b, +.keys.big .ctrl td b, .keys.big .meta td b, .keys.big .shift td b { display: none; diff --git a/keyboard/altgr/emojiworks.eng.inc.pl b/keyboard/altgr/emojiworks.eng.inc.pl new file mode 100644 index 0000000..dca101c --- /dev/null +++ b/keyboard/altgr/emojiworks.eng.inc.pl @@ -0,0 +1,99 @@ +use utf8; +use strict; +use warnings; +no warnings 'qw'; +use Shiar_Sheet::KeyboardChars 'kbchars'; + +my %rows = qw( + ` 🤖 + 1 🦄 + 2 🔥 + 3 🎉 + 4 💰 + ~ 🏻 ! 🏼 @ 🏽 # 🏾 $ 🏿 + 5 🎶 % 🍿 + 6 💩 ^ 🍑 + 7 🙈 & 🌭 + 8 ☀️ * ☔ + 9 👀 ( ❄️ + 0 💯 ) 🇺🇸 + - 🔫 _ 🕊️ + = 💁 + 🙅 + q 👉 Q 👈 ^q ☝ + w ✌ W 🤘 ^w ✊ + e 🙌 E 💪 ^e 🏋 + r 👌 R 👋 ^r 💦 + t 👍 T 👎 ^t 👑 + y ♥ Y 💔 ^y 💙 + u 💕 U 💋 ^u 💏 + i 👏 I ⚡ ^i 🎁 + o 🙏 O 👊 ^o 🕴 + p ✋ P 👆 ^p 🍔 + [ 🌮 { 🍕 + ] ☕ } 🍻 + \ ✨ | 🌟 + a 😍 A 😻 ^a 🏀 + s 😘 S 👫 ^s 🏈 + d 😳 D 😨 ^d ⚽ + f 😜 F 😋 ^f 😝 + g 😊 G 🤗 ^g 🏃 + h 😂 H 😆 ^h 💐 + j 😄 J 🙃 ^j 🌹 + k 😉 K 👯 ^k 🌈 + l 😌 L 💃 ^l 🍭 + ; 😎 : 🤓 + ' 🤔 " 🎅 + z 😈 Z ⛄ ^z 👻 + x 😡 X ☠️ ^x ⚔️ + c 😱 C 🙊 ^c 👽 + v 😬 V 👼 ^v 🛠️ + b 😑 B 😶 ^b 😷 + n 😒 N 🙄 ^n 😏 + m 😢 M 👶 ^m 🐶 + , 😭 < 😖 + . 😔 > 😩 + / 😴 ? 😞 +); + +my $groups = kbchars(\%rows); + +while (my ($k, $c) = each %rows) { + # override letter-based classes by unicode versions + $groups->{def}{''}{$k} = ( + $c =~ /\p{General_Category=Modifier_Symbol}/ ? 'g9' : + $c =~ /\p{In=1.1}/ ? 'g2' : + $c =~ /\p{In=5.2}/ ? 'g3' : + $c =~ /\p{In=6.0}/ ? 'g4' : + $c =~ /\p{In=7.0}/ ? 'g5' : + $c =~ /\p{In=8.0}/ ? 'g7' : + 'g0' # unexpectedly newer + ); +} + ++{ + %{$groups}, + title => 'EmojiWorks', + version => '1.0', + category => 'legacy/emoji', + tableclass => 'keys big', + intro => join("\n", + "Commercial product from 2015 (no longer available)", + "with emoji (Alt) buttons", + "to insert various Unicode emoticons and other symbols.", + ), + description => [ + "Legacy EmojiWorks keyboard layout", + "for typing a selection of Unicode emoji symbols.", + ], + rows => [2, 1, 0], + moderows => '321-21', + image => 'data/keyboard/thumb/emojiworks.jpg', + flag => { + g2 => ['legacy' => "Already in Unicode 1.1 released in 1993 as text symbols"], + g3 => ['predated' => "Updates up to Unicode 5.2 between, retroactively emojified"], + g4 => ['first' => "Initial emoji support with Unicode 6.0 in 2010"], + g5 => ['update' => "Extensions in Unicode 6.1 and 7.0 (2014)"], + g7 => ['latest' => "Added in Unicode 8.0, in 2015 when these characters were selected"], + g9 => ['modifier' => "Fitzpatrick skin colour selection marks in Unicode 8.0"], + }, +} -- 2.30.0 From 92dc64088ef6dfdb273cf9cca397177d5c7e68c4 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 21 Feb 2024 20:40:44 +0100 Subject: [PATCH 07/16] digraphs: encode data include directly as json --- Makefile | 6 +++--- digraphs.plp | 2 +- tools/mkdigraphlist | 28 ++++++++++++---------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index f9c0565..be94112 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ word/put.js: $(download) word/%.min.js: word/%.js uglifyjs -m '' $< -o $@ -data: data/digraphs.inc.pl data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.inc.pl 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.inc.pl data/unicode-sampler word data/DerivedAge.txt: $(download) tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@ @@ -64,7 +64,7 @@ data/digraphs-plan9.txt: data/digraphs-plan9.inc.pl: tools/mkdigraphs-plan9 data/digraphs-plan9.txt $(call cmdsave,$^) -data/digraphs.inc.pl: tools/mkdigraphlist data/digraphs-rfc.inc.pl data/digraphs-vim.inc.pl data/digraphs-shiar.inc.pl data/unicode-char.inc.pl +data/digraphs.json: tools/mkdigraphlist data/digraphs-rfc.inc.pl data/digraphs-vim.inc.pl data/digraphs-shiar.inc.pl data/unicode-char.inc.pl $(call cmdsave,$<) data/unicode-char.inc.pl: tools/mkcharinfo data/digraphs-rfc.inc.pl data/digraphs-shiar.inc.pl data/unicode-age.inc.pl unicode-table.inc.pl @@ -156,7 +156,7 @@ data/browser/usage-wm.inc.pl: tools/mkusage-wikimedia data/browser/usage-wm.tsv $(call cmdsave,$^) clean: - -rm data/digraphs.inc.pl + -rm data/digraphs.json -rm data/unicode-char.inc.pl -rm data/unicode-age.inc.pl -rm -rf data/font/ diff --git a/digraphs.plp b/digraphs.plp index 2f57b36..ccb1987 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -38,7 +38,7 @@ say '

Unofficial proposals', :> <: -my $di = Data('data/digraphs'); +my $di = Data('digraphs'); if (exists $get{v}) { # show characters for inverted mnemonics (vim alternatives) diff --git a/tools/mkdigraphlist b/tools/mkdigraphlist index 3bc6ff4..5356987 100755 --- a/tools/mkdigraphlist +++ b/tools/mkdigraphlist @@ -5,8 +5,9 @@ use warnings; use utf8; use open OUT => ':encoding(utf-8)', ':std'; +use JSON (); -our $VERSION = '1.06'; +our $VERSION = '1.07'; # import and combine various digraph data push @INC, 'data'; @@ -24,18 +25,14 @@ my $di = { %{$vim // {}}, %{$rfc}, %{$extra // {}} }; my $uninfo = do 'unicode-char.inc.pl' or warn "could not include unicode details: ", $@ // $!; -# output perl code of hash -# (assume no backslashes or curlies, so we can just q{} w/o escaping) -print "# automatically generated by $0\n"; -print "use utf8;\n"; -print "+{\n"; -printf '(map {$_=>0} qw{%s}),'."\n", join(' ', +# output json map of character info +my %table; +$table{$_} = 0 for ( grep { !defined $di->{$_} } map { substr($_, 1, 1).substr($_, 0, 1) } sort keys %{$di} ); -printf "q{%s}=>[%s],\n", s/(?=[\\}])/\\/gr, join(',', +$table{$_} = [ ord $di->{$_}, # original code point - map {"'$_'"} $uninfo->{ $di->{$_} }->[1] // '', # name join(' ', $rfc->{$_} @@ -45,8 +42,8 @@ printf "q{%s}=>[%s],\n", s/(?=[\\}])/\\/gr, join(',', ), ($uninfo->{ $di->{$_} }->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class $uninfo->{ $di->{$_} }->[4] // (), # string -) for sort keys %{$di}; -print "}\n"; +] for sort keys %{$di}; +print JSON->new->ascii->canonical->encode(\%table); __END__ @@ -56,8 +53,7 @@ mkdigraphlist - Output character list of combined digraph data =head1 SYNOPSIS - mkdigraphlist >digraphs.inc.pl - perl -e'$di = do "digraphs.inc.pl"; print chr $di->{DO}->[0]' + mkdigraphlist | jq -r '."DO"[0]' | perl -nE 'say chr' # $ =head1 DESCRIPTION @@ -72,9 +68,9 @@ is appended: character name, usage classes, unicode classes, and replacement output string. For example: - +{ - AE => [198, 'LATIN CAPITAL LETTER AE', 'u-di', 'Latin Lu Xl u-v11'], - EA => 'AE', + { + "AE" => [198, "LATIN CAPITAL LETTER AE", "u-di", "Latin Lu Xl u-v11"], + "EA" => "AE", } =head1 AUTHOR -- 2.30.0 From 61b25c1967cc0ebd45e88802fcfb8c4f81363981 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 21 Feb 2024 20:52:19 +0100 Subject: [PATCH 08/16] digraphs: include flag legend in include data --- digraphs.plp | 31 ++++++++++++++++--------------- tools/mkdigraphlist | 22 +++++++++++++++++----- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/digraphs.plp b/digraphs.plp index ccb1987..4ee4d1f 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -42,9 +42,9 @@ my $di = Data('digraphs'); if (exists $get{v}) { # show characters for inverted mnemonics (vim alternatives) - $di->{ substr($_, 1, 1) . substr($_, 0, 1) } ||= - [ $di->{$_}->[0], '', 'l0 ex', '', $di->{$_}->[4] ] - for grep { ref $di->{$_} } keys %{$di}; + $di->{key}->{ substr($_, 1, 1) . substr($_, 0, 1) } ||= [ + $di->{key}->{$_}->[0], '', 'l0 ex', '', $di->{key}->{$_}->[4] + ] for grep { ref $di->{key}->{$_} } keys %{ $di->{key} }; } my @chars = ( @@ -61,8 +61,10 @@ if ($mode) { my $xorg = Data('data/digraphs-xorg'); $_ = [ord $_] for values %{$xorg}; $xorg->{$_}->[2] = # class = compatibility - $di->{$_} ? $di->{$_}->[0] != $xorg->{$_}->[0] ? 'l1' : # conflict - $di->{$_}->[2] eq 'l4' ? 'l5' : 'l3' : 'l2' # rfc|any|none + !$di->{key}->{$_} ? 'l2' : # free + $di->{key}->{$_}->[0] != $xorg->{$_}->[0] ? 'l1' : # conflict + $di->{key}->{$_}->[2] eq 'l4' ? 'l5' : # rfc + 'l3' # any for keys %{$xorg}; for my $cp (map {$_->[0]} values %{$xorg}) { @@ -85,7 +87,7 @@ if ($mode) { $chars2[0] = [qw( # ^ _ ` ~ )]; @chars = @chars2; - $di = $xorg; + $di->{key} = $xorg; } for my $colchars (@columns) { @@ -103,15 +105,16 @@ for my $c1group (@chars) { print '', EscapeHTML($c1); for my $c2 (map {@$_} @$colchars) { my $mnem = $c1 . $c2; - if (not defined $di->{$mnem}) { + if (not defined $di->{key}->{$mnem}) { print ''; next; } - if (ref $di->{$mnem} ne 'ARRAY') { + if (ref $di->{key}->{$mnem} ne 'ARRAY') { printf '', EscapeHTML($mnem); next; } - my ($codepoint, $name, $support, $script, $string) = @{ $di->{$mnem} }; + my ($codepoint, $name, $support, $script, $string) = + @{ $di->{key}->{$mnem} }; my $glyph = $string || chr $codepoint; utf8::upgrade($glyph); # prevent latin1 output @@ -166,12 +169,10 @@ if ($mode) { chinese - -
full support - vim extension - vim v8.0 - proposal - not in vim + <: + print qq(\n\t
$di->{flag}->{$_}) + for sort keys %{ $di->{flag} }; +:>
diff --git a/tools/mkdigraphlist b/tools/mkdigraphlist index 5356987..075d564 100755 --- a/tools/mkdigraphlist +++ b/tools/mkdigraphlist @@ -43,7 +43,17 @@ $table{$_} = [ ($uninfo->{ $di->{$_} }->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class $uninfo->{ $di->{$_} }->[4] // (), # string ] for sort keys %{$di}; -print JSON->new->ascii->canonical->encode(\%table); + +print JSON->new->ascii->canonical->encode({ + key => \%table, + flag => { + l4 => 'full support', + l3 => 'vim extension', + 'l3 ex' => 'vim v8.0', + l2 => 'proposal', + l1 => 'not in vim', + }, +}); __END__ @@ -53,14 +63,14 @@ mkdigraphlist - Output character list of combined digraph data =head1 SYNOPSIS - mkdigraphlist | jq -r '."DO"[0]' | perl -nE 'say chr' # $ + mkdigraphlist | jq -r '.key."DO"[0]' | perl -nE 'say chr' # $ =head1 DESCRIPTION Combines precompiled digraph includes of rfc (1345), vim, and shiar and outputs a complete map including character details and usage classes. -The value can either be a scalar string containing another +The C values can either be a scalar string containing another digraph which can be considered identical (usually inverted), or an array ref containing at least the resulting character's Unicode code point value. If available, the following UCD data @@ -69,8 +79,10 @@ and replacement output string. For example: { - "AE" => [198, "LATIN CAPITAL LETTER AE", "u-di", "Latin Lu Xl u-v11"], - "EA" => "AE", + "key": { + "AE" => [198, "LATIN CAPITAL LETTER AE", "u-di", "Latin Lu Xl u-v11"], + "EA" => "AE", + } } =head1 AUTHOR -- 2.30.0 From 9445c538bedc82733b7b1c6eb9df7bf9cb54ed64 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 21 Feb 2024 21:01:16 +0100 Subject: [PATCH 09/16] digraphs/xorg: json include with character info Similar to primary [vim] data so precedence can be preserved as alias class (ignored for now). --- Makefile | 4 ++-- digraphs.plp | 4 ++-- tools/mkdigraphs-xorg | 21 +++++++++++++++------ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index be94112..df6cbe5 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ word/put.js: $(download) 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.inc.pl 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 data/DerivedAge.txt: $(download) tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@ @@ -53,7 +53,7 @@ data/keysymdef.h: $(download) tools/wget-ifmodified http://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/$(@F) $@ data/keysymdef.json: tools/mkxkeysymdef data/keysymdef.h $(call cmdsave,$^) -data/digraphs-xorg.inc.pl: tools/mkdigraphs-xorg data/xorg-compose data/keysymdef.json +data/digraphs-xorg.json: tools/mkdigraphs-xorg data/xorg-compose data/keysymdef.json $(call cmdsave,$^) data/digraphs-vim.inc.pl: tools/mkdigraphs-vim diff --git a/digraphs.plp b/digraphs.plp index 4ee4d1f..6b1a5c2 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -58,8 +58,8 @@ my @columns = !exists $get{split} ? \@chars2 : ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]); if ($mode) { - my $xorg = Data('data/digraphs-xorg'); - $_ = [ord $_] for values %{$xorg}; + my $xorg = Data('digraphs-xorg'); + $_->[3] = undef for values %{$xorg}; # reset alias classes $xorg->{$_}->[2] = # class = compatibility !$di->{key}->{$_} ? 'l2' : # free $di->{key}->{$_}->[0] != $xorg->{$_}->[0] ? 'l1' : # conflict diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index 90b0d86..ec0e862 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -15,9 +15,11 @@ my $symname = eval { return decode_json(readline $keysymh); } or die "Could not read keysym definitions: $@\n"; -say "# automatically generated by $0"; -say '+{'; +# optionally get unicode character information +my $uninfo = do './data/unicode-char.inc.pl' + or warn "could not include unicode details: ", $@ // $!; +my %table; while ($_ = readline) { my ($mnem, $chr, $trail) = m/\A \h (.*?) \h+ : \h "([^"]+)" \h* (.*)/ or next; @@ -27,12 +29,19 @@ while ($_ = readline) { $mnem =~ s{<([^>]+)> \h?}{$symname->{$1} // die "reference to unknown keysym $1\n"}eg; 1; } or warn($@), next; - $mnem !~ m/[^\x20-\x7F]/ or next; # skip unicode -# (state $seen = {})->{$chr}++ and next; - printf "%s => %s,\n", pp($mnem), pp($chr); + $mnem =~ m/\A [\x20-\x7F]{2} \z/ or next; # only interested in two ascii + my $alias = (state $seen = {})->{$chr}++; # assume first is preferred + $table{$mnem} = [ + ord $chr, + $uninfo->{$chr}->[1] // '', # name + 0, # comparison + $alias ? 'l0 ex' : + ($uninfo->{$chr}->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class + $uninfo->{$chr}->[4] // (), # string + ]; } -say '}'; +print JSON->new->canonical->indent->encode(\%table); __END__ -- 2.30.0 From 8f93eb6627b93ef73026457b041c7210b098ba74 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 22 Feb 2024 18:56:51 +0100 Subject: [PATCH 10/16] digraphs: prepare xorg comparison in prebuilt data Replace the entire character table, unifying level classes with vim foregrounds (renaming u-l3 in the process). Differences are indicated similar to before, but keeping declared alias preferences without effort to find vim matches (which is accidental and not of interest to most users, while losing distinction of intended precedence). --- base.css | 12 +++++------ digraphs.plp | 50 ++++++------------------------------------- tools/mkdigraphs-xorg | 45 +++++++++++++++++++++++++++----------- 3 files changed, 44 insertions(+), 63 deletions(-) diff --git a/base.css b/base.css index b0f7312..e4ed58d 100644 --- a/base.css +++ b/base.css @@ -520,10 +520,10 @@ table.dimap { .u-invalid {background: #BBB} /* invalid, impossible */ /* foreground representation */ -#digraphs .u-l3 {color: #080} /* partial */ -#digraphs .u-l3.ex {color: #4C0} /* experimental */ -#digraphs .u-l2 {color: #A44; color: rgba(128, 0, 0, .6)} /* unofficial proposal */ -#digraphs .u-l1 {color: #D00; color: rgba(255, 0, 0, .8)} /* minimal or invalid */ +#digraphs .u-l4 {color: #080} /* partial */ +#digraphs .u-l5 {color: #4C0} /* experimental */ +#digraphs .u-l2 {color: #A44; color: rgba(128, 0, 0, .6)} /* unofficial */ +#digraphs .u-l1 {color: #D00; color: rgba(255, 0, 0, .8)} /* missing */ /* support percentage (browser cells) */ .p0 {opacity: .6} @@ -595,8 +595,8 @@ table.dimap { .l3:hover {background: #FF8} .l4:hover {background: #CF8} .l5:hover {background: #8F8} -.u-l3:hover {outline: 1px solid #080} -.u-l3.ex:hover {outline: 1px solid #8F0} +.u-l4:hover {outline: 1px solid #080} +.u-l5:hover {outline: 1px solid #8F0} .u-l2:hover {outline: 1px solid #800} .u-l1:hover {outline: 1px solid #F00} diff --git a/digraphs.plp b/digraphs.plp index 6b1a5c2..57d0b0f 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -2,6 +2,7 @@ my $mode = ($Request // '') eq 'xorg' || exists $get{xorg}; my $modename = $mode ? 'X.Org' : 'RFC-1345'; +my $cmp = exists $get{cmp} ? ($get{cmp} // 1) : !!$Request; Html({ title => 'digraph cheat sheet', @@ -58,36 +59,9 @@ my @columns = !exists $get{split} ? \@chars2 : ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]); if ($mode) { - my $xorg = Data('digraphs-xorg'); - $_->[3] = undef for values %{$xorg}; # reset alias classes - $xorg->{$_}->[2] = # class = compatibility - !$di->{key}->{$_} ? 'l2' : # free - $di->{key}->{$_}->[0] != $xorg->{$_}->[0] ? 'l1' : # conflict - $di->{key}->{$_}->[2] eq 'l4' ? 'l5' : # rfc - 'l3' # any - for keys %{$xorg}; - - for my $cp (map {$_->[0]} values %{$xorg}) { - next if (state $seen = {})->{$cp}++; # List::MoreUtils::uniq - - # find multiple equivalent mnemonics - my @equiv = grep {$cp eq $_->[0]} - map {$xorg->{$_}} sort keys %{$xorg}; # values ordered by mnem. - - # search for the most compatible match - my ($compat) = sort { - $equiv[$b]->[2] cmp $equiv[$a]->[2] # highest level - || $b <=> $a # fallback to last mnemonic - } 0 .. $#equiv; - - # reclassify all but one as level 0 (omitted) - splice @equiv, $compat // -1, 1, (); - $_->[2] = 'l0 ex' for @equiv; - } - + $di = Data('digraphs-xorg'); $chars2[0] = [qw( # ^ _ ` ~ )]; @chars = @chars2; - $di->{key} = $xorg; } for my $colchars (@columns) { @@ -120,7 +94,7 @@ for my $c1group (@chars) { utf8::upgrade($glyph); # prevent latin1 output my $desc = $mnem . ($name && " ($name)"); my @class = ('X', grep {$_} $script); - push @class, $mode ? $support : "u-$support" if $support; + push @class, $cmp ? $support : "u-$support" if $support; $glyph = EscapeHTML($glyph); $glyph = "$glyph" if $script =~ /\bZs\b/; @@ -135,19 +109,8 @@ say '
'; print '


' if exists $get{split}; } -if ($mode) { :> -
- -
matching RFC-1345 - matching proposal - unique to Xorg - conflict - duplicate -
-
-<: } else { :> -
+
<: unless ($cmp) { :>
control space @@ -168,12 +131,11 @@ if ($mode) { japanese chinese
- +<: } :> <: - print qq(\n\t
$di->{flag}->{$_}) + printf qq(\n\t%s), (!$cmp && 'u-').$_, $di->{flag}->{$_} for sort keys %{ $di->{flag} }; :>
-<: } diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index ec0e862..8df64cd 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -6,6 +6,7 @@ use open IO => ':encoding(utf-8)', ':std'; use re '/msx'; use JSON 'decode_json'; use Data::Dump 'pp'; +use Shiar_Sheet::FormatChar; our $VERSION = '1.01'; @@ -15,9 +16,11 @@ my $symname = eval { return decode_json(readline $keysymh); } or die "Could not read keysym definitions: $@\n"; -# optionally get unicode character information -my $uninfo = do './data/unicode-char.inc.pl' - or warn "could not include unicode details: ", $@ // $!; +my $vidi = eval { + open my $jsfh, '<', 'data/digraphs.json' or die $!; + local $/; + return JSON->new->decode(readline $jsfh); +} or warn "Could not read comparison digraphs: $@\n"; my %table; while ($_ = readline) { @@ -31,17 +34,33 @@ while ($_ = readline) { } or warn($@), next; $mnem =~ m/\A [\x20-\x7F]{2} \z/ or next; # only interested in two ascii my $alias = (state $seen = {})->{$chr}++; # assume first is preferred + my $cp = ord $chr; + my $uninfo = Shiar_Sheet::FormatChar->glyph_info($cp); + my $comparison = ( + !$vidi->{key}->{$mnem} ? 'l3' : # free + $vidi->{key}->{$mnem}->[0] != $cp ? 'l1' : # conflict + $vidi->{key}->{$mnem}->[2] eq 'l4' ? 'l5' : # rfc + 'l4' # any + ); $table{$mnem} = [ - ord $chr, - $uninfo->{$chr}->[1] // '', # name - 0, # comparison - $alias ? 'l0 ex' : - ($uninfo->{$chr}->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class - $uninfo->{$chr}->[4] // (), # string + $cp, + $uninfo->[1] // '', # name + $comparison, + $alias ? 'l0 ex' : $uninfo->[0] // '', # class + $uninfo->[4] // (), # string ]; } -print JSON->new->canonical->indent->encode(\%table); +print JSON->new->canonical->indent->encode({ + key => \%table, + flag => { + 'l5' => "matching RFC-1345", + 'l4' => "matching proposal", + 'l3' => "unique to Xorg", + 'l1' => "conflict", + 'l0 ex' => "duplicate", + }, +}); __END__ @@ -52,13 +71,13 @@ mkdigraphs-xorg - Output Xorg compose sequences =head1 SYNOPSIS - mkdigraphs-xorg /usr/share/X11/locale/en_US.UTF-8/Compose >digraphs-xorg.inc.pl - perl -e'$di = do "digraphs-xorg.inc.pl"; print chr $di->{AT}' + mkdigraphs-xorg /usr/share/X11/locale/en_US.UTF-8/Compose | + jq -r '.key."AT"[0]' | perl -nE 'say chr' # @ =head1 DESCRIPTION Extracts Multi_key definitions from X11/Xorg Compose.pre include file. -If successful, Perl code is output resulting in a hash +If successful, a JSON object is output containing a digraphs list in C with Unicode code points keyed by mnemonics. Any errors and warnings are given at STDERR. -- 2.30.0 From b7fdc8bc4fb07d537722ed0ab50922035e4fd148 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 21 Feb 2024 22:46:02 +0100 Subject: [PATCH 11/16] digraphs: page metadata in subpage includes Standalone xorg replacement without hardcoded html exceptions, and support to easily define other layouts and options. --- digraphs.plp | 49 +++++++++++++++++-------------------------- tools/mkdigraphlist | 11 ++++++++++ tools/mkdigraphs-xorg | 8 +++++++ 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/digraphs.plp b/digraphs.plp index 57d0b0f..6e0608c 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -1,45 +1,34 @@ <(common.inc.plp)><: -my $mode = ($Request // '') eq 'xorg' || exists $get{xorg}; -my $modename = $mode ? 'X.Org' : 'RFC-1345'; +my $mode = $Request || 'vim'; +my $include = 'digraphs' . ($mode ne 'vim' && "-$mode"); my $cmp = exists $get{cmp} ? ($get{cmp} // 1) : !!$Request; +my $di = eval { Data($include) } || {}; +warn "error in $include: ", @{$@} if ref $@; + Html({ - title => 'digraph cheat sheet', + title => "$mode digraph cheat sheet", version => '1.3', - description => [ - "Complete table of digraph characters from $modename.", + description => $di->{description} // [ + "Complete table of digraph characters from", + ($di->{title} // $mode) . ".", ], - keywords => [qw' + keywords => [@{ $di->{keywords} // [] }, qw' digraph mnemonic compose composition pair - character char glyph table unicode vim xorg x11 x + character char glyph table unicode vim '], stylesheet => [qw'light'], - data => [qw( data/digraphs.inc.pl )], + data => ["data/$include.json"], }); -:> -

<:= $modename :> Digraphs

- -

Character mnemonics following compose key ⎄<: -say join("\n", - $mode ? ( - ' in the X Window System (Shift+AltGr by default).', - 'Differences from RFC-1345 are indicated.', - ) : (':', - 'i^k in Vim,', - '^u^\ in Emacs,', - '^a^v in Screen.', - 'Similar but different from X.Org.', - ), - 'Also see common Unicode.

', +%{$di} or Abort( + "Requested digraphs $mode not available", + '404 request not found', ); -say '

Unofficial proposals', - ' are available as ex commands.' if not $mode; -:> -<: -my $di = Data('digraphs'); +say "

$di->{title} Digraphs

"; +say "

$_

" for $di->{intro} // (); if (exists $get{v}) { # show characters for inverted mnemonics (vim alternatives) @@ -58,8 +47,8 @@ my @chars2 = (['_'], @chars); # trailing character (extended set) my @columns = !exists $get{split} ? \@chars2 : ([@chars2[0, 1, 3, 4, 6]], [@chars2[2, 5, 7]]); -if ($mode) { - $di = Data('digraphs-xorg'); +if ($mode eq 'xorg') { + #TODO determine character usage from declared keys $chars2[0] = [qw( # ^ _ ` ~ )]; @chars = @chars2; } diff --git a/tools/mkdigraphlist b/tools/mkdigraphlist index 075d564..2f6acc8 100755 --- a/tools/mkdigraphlist +++ b/tools/mkdigraphlist @@ -45,7 +45,18 @@ $table{$_} = [ ] for sort keys %{$di}; print JSON->new->ascii->canonical->encode({ + title => 'RFC-1345', key => \%table, + intro => join("\n", + 'Character mnemonics following compose key ⎄:', + 'i^k in Vim,', + '^u^\ in Emacs,', + '^a^v in Screen.', + 'Similar but different from X.Org.', + 'Also see common Unicode.

', + '

Unofficial proposals', + 'are available as ex commands.', + ), flag => { l4 => 'full support', l3 => 'vim extension', diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index 8df64cd..edef62d 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -52,7 +52,15 @@ while ($_ = readline) { } print JSON->new->canonical->indent->encode({ + title => 'X.Org', key => \%table, + intro => join("\n", + 'Character mnemonics following compose key ⎄:', + 'in the X Window System (Shift+AltGr by default).', + 'Differences from RFC-1345 are indicated.', + 'Also see common Unicode.', + ), + keywords => [qw( xorg x11 x )], flag => { 'l5' => "matching RFC-1345", 'l4' => "matching proposal", -- 2.30.0 From 800cd11bec46c84a8187b9180f0a7684e7be7d1c Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 24 Feb 2024 14:43:18 +0100 Subject: [PATCH 12/16] digraphs: translate vim support levels to appropriate fg classes Emulate styling before renumbering in commit v1.17-57-g8f93eb6627 (2024-03-06) [prepare xorg comparison in prebuilt data]. --- digraphs.plp | 5 +++-- tools/mkdigraphlist | 18 +++++++++++------- tools/mkdigraphs-xorg | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/digraphs.plp b/digraphs.plp index 6e0608c..05d9241 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -83,7 +83,8 @@ for my $c1group (@chars) { utf8::upgrade($glyph); # prevent latin1 output my $desc = $mnem . ($name && " ($name)"); my @class = ('X', grep {$_} $script); - push @class, $cmp ? $support : "u-$support" if $support; + push @class, $cmp ? $support : + $di->{flagclass}->{$support} // "u-$support" if $support; $glyph = EscapeHTML($glyph); $glyph = "$glyph" if $script =~ /\bZs\b/; @@ -122,7 +123,7 @@ print '


' if exists $get{split}; <: } :> <: - printf qq(\n\t
%s), (!$cmp && 'u-').$_, $di->{flag}->{$_} + printf qq(\n\t%s), $cmp ? $_ : $di->{flagclass}{$_} // "u-$_", $di->{flag}->{$_} for sort keys %{ $di->{flag} }; :>
diff --git a/tools/mkdigraphlist b/tools/mkdigraphlist index 2f6acc8..5117b76 100755 --- a/tools/mkdigraphlist +++ b/tools/mkdigraphlist @@ -34,13 +34,13 @@ $table{$_} = 0 for ( $table{$_} = [ ord $di->{$_}, # original code point $uninfo->{ $di->{$_} }->[1] // '', # name - join(' ', + ( $rfc->{$_} - ? $vim->{$_} ? 'l4' : 'l1' # vim+rfc or rfc only + ? $vim->{$_} ? 'l5' : 'l1' # vim+rfc or rfc only + : $vimold && $vimold->{$_} ? 'l4' # compat vim if known : $vim->{$_} ? 'l3' : 'l2', # vim only or neither - $vimold && $vim->{$_} && !$vimold->{$_} ? 'ex' : (), # new vim feature ), - ($uninfo->{ $di->{$_} }->[0] // '') =~ s/ u-di| u-prop| ex//gr, # class + ($uninfo->{ $di->{$_} }->[0] // '') =~ s/ u-di| u-prop//gr, # class $uninfo->{ $di->{$_} }->[4] // (), # string ] for sort keys %{$di}; @@ -58,12 +58,16 @@ print JSON->new->ascii->canonical->encode({ 'are available as ex commands.', ), flag => { - l4 => 'full support', - l3 => 'vim extension', - 'l3 ex' => 'vim v8.0', + l5 => 'full support', + l4 => 'vim extension', + l3 => 'vim v8.0', l2 => 'proposal', l1 => 'not in vim', }, + flagclass => { + l5 => '', # common + l3 => 'u-l5', # rare + }, }); __END__ diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index edef62d..67c60a6 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -39,7 +39,7 @@ while ($_ = readline) { my $comparison = ( !$vidi->{key}->{$mnem} ? 'l3' : # free $vidi->{key}->{$mnem}->[0] != $cp ? 'l1' : # conflict - $vidi->{key}->{$mnem}->[2] eq 'l4' ? 'l5' : # rfc + $vidi->{key}->{$mnem}->[2] eq 'l5' ? 'l5' : # rfc 'l4' # any ); $table{$mnem} = [ -- 2.30.0 From 885337ac8f6df8b7971248d0c31eed25ab5b8123 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 24 Feb 2024 16:18:27 +0100 Subject: [PATCH 13/16] digraphs/xorg: hide reversed aliases, matchvim option Imply expected duplicates, similar to vim; only keep exceptions annotated. Optional feature to find comparisons as before commit v1.17-57-g8f93eb6627 (2024-03-06) [prepare xorg comparison in prebuilt data]. --- digraphs.plp | 2 +- tools/mkdigraphs-xorg | 49 +++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/digraphs.plp b/digraphs.plp index 05d9241..5b5f414 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -79,7 +79,7 @@ for my $c1group (@chars) { my ($codepoint, $name, $support, $script, $string) = @{ $di->{key}->{$mnem} }; - my $glyph = $string || chr $codepoint; + my $glyph = $string || !!$codepoint && chr $codepoint; utf8::upgrade($glyph); # prevent latin1 output my $desc = $mnem . ($name && " ($name)"); my @class = ('X', grep {$_} $script); diff --git a/tools/mkdigraphs-xorg b/tools/mkdigraphs-xorg index 67c60a6..be53fff 100755 --- a/tools/mkdigraphs-xorg +++ b/tools/mkdigraphs-xorg @@ -10,6 +10,8 @@ use Shiar_Sheet::FormatChar; our $VERSION = '1.01'; +my $matchvim; # enable to prefer best compatibility + my $symname = eval { open my $keysymh, '<', 'data/keysymdef.json' or die $!; local $/; @@ -33,22 +35,42 @@ while ($_ = readline) { 1; } or warn($@), next; $mnem =~ m/\A [\x20-\x7F]{2} \z/ or next; # only interested in two ascii - my $alias = (state $seen = {})->{$chr}++; # assume first is preferred + + my $alias = \(state $seen = {})->{$chr}; # assume first is preferred my $cp = ord $chr; - my $uninfo = Shiar_Sheet::FormatChar->glyph_info($cp); + my ($class, $name, undef, undef, $string) = @{ + Shiar_Sheet::FormatChar->glyph_info($cp) + }; my $comparison = ( !$vidi->{key}->{$mnem} ? 'l3' : # free $vidi->{key}->{$mnem}->[0] != $cp ? 'l1' : # conflict $vidi->{key}->{$mnem}->[2] eq 'l5' ? 'l5' : # rfc 'l4' # any ); - $table{$mnem} = [ - $cp, - $uninfo->[1] // '', # name - $comparison, - $alias ? 'l0 ex' : $uninfo->[0] // '', # class - $uninfo->[4] // (), # string - ]; + + if (${$alias}) { + # aliases an earlier occurrence + if ($matchvim and ${$alias}->[2] lt $comparison) { + # replace lower compatibility level + ${$alias}->[3] = 'l0'; + ${$alias}->[2] .= ' u-' . ${$alias}->[2]; + ${$alias} = undef; + } + else { + $class = 'l0'; + my $menm = substr($mnem, 1, 1).substr($mnem, 0, 1); + if ($table{$menm} && $table{$menm}[0] == $cp) { + # unannotated if identical to reversed input + $cp = 0; + } + else { + $class .= ' ex'; + } + } + } + + $table{$mnem} = [ $cp, $name, $comparison, $class, $string // () ]; + ${$alias} //= $table{$mnem}; } print JSON->new->canonical->indent->encode({ @@ -63,10 +85,15 @@ print JSON->new->canonical->indent->encode({ keywords => [qw( xorg x11 x )], flag => { 'l5' => "matching RFC-1345", - 'l4' => "matching proposal", + 'l4' => "matching Vim extension", 'l3' => "unique to Xorg", 'l1' => "conflict", - 'l0 ex' => "duplicate", + ('l0' => "Xorg preference") x !!$matchvim, + 'l0 ex' => "alias", + }, + flagclass => { + l5 => 'u-l4', + l4 => 'u-l5', }, }); -- 2.30.0 From d554ba953e645559ddd2a01b322b24d22453923c Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 29 Feb 2024 19:43:22 +0100 Subject: [PATCH 14/16] dieren: what does the fox say? --- dieren.inc.pl | 1 + dieren.plp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dieren.inc.pl b/dieren.inc.pl index ab3d781..169fb81 100644 --- a/dieren.inc.pl +++ b/dieren.inc.pl @@ -19,6 +19,7 @@ use utf8; #olifant: +olifant +zeeolifant +olifantsvis ?kamerolifant - #olifantsoor beer: +beer +zeebeer waterbeertje ijsbeer +wasbeer #neusbeer leeuw: +leeuw +zeeleeuw ?waterleeuw? ?aardleeuw?=kameleon +mierenleeuw #leeuwerik +#vos: vos +zeevos=voshaai - koolvos voskonijn #Zorro wolf: +wolf +zeewolf ?waterwolf?=snoek aardwolf +korenwolf #bijenwolf haan: +haan +zeehaan waterhaan rotshaan +sprinkhaan #wilde_haan?=wildrooster #pad: pad ?zebrapad rivierdonderpad landpad schildpad #paddenstoel diff --git a/dieren.plp b/dieren.plp index 03d0dc9..8e66008 100644 --- a/dieren.plp +++ b/dieren.plp @@ -34,7 +34,7 @@ my $pageinfo = $subpages{$Request} Html({ title => $pageinfo->{title}.' cheat sheet', - version => '1.1', + version => '1.2', lang => 'nl', description => "Tabeloverzicht met afbeeldingen van $pageinfo->{intro}", keywords => [qw' @@ -126,7 +126,7 @@ for my $row (@{$table}) { $name .= " ($alt)" if $alt; printf '', $hidden && !$pageinfo->{secrets} && ' hidden'; - if ($img and -e ($img = "data/dieren/$img.jpg")) { + if ($img and -e ($img = lc "data/dieren/$img.jpg")) { printf '%s'; -- 2.30.0 From 4c28c0f1dd2556ecb920f2cea1785527e6c44a06 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 21 Feb 2024 22:48:42 +0100 Subject: [PATCH 15/16] common: omit trailing slash from requestless canonical links --- common.inc.plp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.inc.plp b/common.inc.plp index 8a13059..ee21f02 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -157,7 +157,8 @@ sub Html { my ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x; - if (my $url = $meta->{canonical} // "/$file/$Request") { + $meta->{canonical} //= "/$file" . ($Request ne '' && "/$Request"); + if (my $url = $meta->{canonical}) { $url = "https://sheet.shiar.nl$url"; push @{ $meta->{raw} }, qq(); } -- 2.30.0 From 7dcd95ca1bc9fb7330103791695eec05085d67af Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 6 Mar 2024 00:00:08 +0100 Subject: [PATCH 16/16] index: release v1.18 with only altgr index linked --- common.inc.plp | 2 +- digraphs.plp | 2 +- index.plp | 5 ++--- perl.plp | 2 +- tools/mksitemap | 6 ++++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common.inc.plp b/common.inc.plp index ee21f02..a634733 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -76,7 +76,7 @@ sub stylesheet { return map { sprintf( '', - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.17", $_ + $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.18", $_ ) } @avail; } diff --git a/digraphs.plp b/digraphs.plp index 5b5f414..9f96c50 100644 --- a/digraphs.plp +++ b/digraphs.plp @@ -9,7 +9,7 @@ warn "error in $include: ", @{$@} if ref $@; Html({ title => "$mode digraph cheat sheet", - version => '1.3', + version => '1.4', description => $di->{description} // [ "Complete table of digraph characters from", ($di->{title} // $mode) . ".", diff --git a/index.plp b/index.plp index 6909025..f05c02a 100644 --- a/index.plp +++ b/index.plp @@ -3,7 +3,7 @@ Html({ title => 'cheat sheets', canonical => '/', - version => '1.17', + version => '1.18', description => [ "Cheat sheets summarising various software programs and standards.", ], @@ -54,8 +54,7 @@ if (open my $log, '<', 'UPDATE') {{
  • mutt
  • nethack
  • mplayer/mpv -
  • altgr - etc. +
  • altgr/option
  • diff --git a/perl.plp b/perl.plp index 2d9cb01..596e4d8 100644 --- a/perl.plp +++ b/perl.plp @@ -2,7 +2,7 @@ Html({ title => 'perl version cheat sheet', - version => '1.5', + version => '1.6', keywords => [qw' perl version feature features comparison sheet cheat overview summary diff --git a/tools/mksitemap b/tools/mksitemap index cbffc0b..0b4a734 100755 --- a/tools/mksitemap +++ b/tools/mksitemap @@ -2,7 +2,7 @@ use 5.014; use warnings; -our $VERSION = '1.03'; +our $VERSION = '1.04'; use File::stat; use Time::Piece; @@ -18,9 +18,11 @@ my @pages = ( )], [qw( apl less screen digits sc/bw sc/hots termcol/legacy mplayer + digraphs/xorg keyboard/altgr/macos-abc keyboard/altgr/msx keyboard/altgr/ukext keyboard/altgr/eurkey keyboard/altgr/apl keyboard/altgr/spacecadet - keyboard/altgr/ipa + keyboard/altgr/ipa keyboard/altgr/boyeg keyboard/altgr/drix + keyboard/altgr/symbolics keyboard/altgr/msx-graph )], [qw( chars/table/html sample source plan )], ); -- 2.30.0