X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/c1d474c10566cbc9591267934dfa103a61f7c486..d2de36b8cc74f75b168981c233d31c59f24d3ab0:/keyboard.plp?ds=sidebyside
diff --git a/keyboard.plp b/keyboard.plp
index 3a8f35f..c96977d 100644
--- a/keyboard.plp
+++ b/keyboard.plp
@@ -1,58 +1,37 @@
<(common.inc.plp)><:
+my $mode = lc($Request || 'altgr');
+my $include = "$mode.eng";
+
+my $info = eval { Data($include) } || {};
+$mode = $info->{title} // $mode;
+
Html({
- title => 'keyboard cheat sheet',
- version => '1.0',
+ title => "\L$mode\E keyboard cheat sheet",
+ version => $info->{version} || '0.1',
+ description => $info->{description} //
+ ["Keyboard cheat sheet for the default controls of $mode."],
+ keywords => [@{ $info->{keywords} // [] }, qw'
+ sheet cheat reference overview keyboard control commands shortkey
+ '],
stylesheet => [qw( light dark circus mono red )],
keys => 1,
+ data => ["$include.inc.pl"],
});
-:>
-
keyboard cheat sheet
-
-normal mode (default)
+%{$info} or Abort(
+ "Requested keyboard $mode
not available",
+ '404 request not found',
+);
-<:
-use Shiar_Sheet::Keyboard 2.07;
-use Unicode::Normalize qw( NFKD );
+say "$mode cheat sheet
";
+say "$_
" for $info->{intro} // ();
+say "", $info->{mode}->{''}, " (default)
"
+ if $info->{mode} and %{ $info->{mode} } > 1;
-my $usint = [
- [ 'a' .. 'z'],
- [qw(à B ¢ à à F G H à J Šà µ à à à à ® § à à V Ã
X Ã Ã)],
- [qw(á b © ð é f g h à j Šø µ ñ ó ö ä ® à þ ú v å x ü æ)],
- [qw(Ã
ı à ð ´ Ì Ë Ì£ Ë Â½  à ¾ Ë Ã â Å â° / Ë Â¨ â â Ë Â¼ ¸)],
- [qw(Ã¥ ⫠ç â ´ Æ Â© Ë ^ â ° ¬ µ ~ ø Ï Å Â® à â ¨ â â â Â¥ Ω)],
-];
-
-my $keys = Shiar_Sheet::Keyboard->new({
- def => {
- '' => {
- map {
- my $c = $_;
- my @row = map { $usint->[$_]->[$c] } 0 .. 2;
- my $class = (
- !defined $row[2] || $row[0] eq $row[2] ? 1 # identical
- : NFKD($row[2]) =~ $row[0] ? 2 # equivalent
- : $row[2] =~ /^\p{Latin}/ ? 3 # latin
- : 4
- );
- $row[0] => "g$class"
- } 0 .. $#{ $usint->[0] }
- },
- },
- key => {
- map {
- $usint->[0]->[$_] => "$usint->[1]->[$_]
$usint->[2]->[$_]"
- } 0 .. $#{ $usint->[0] }
- },
- flag => {
- g1 => ['unaltered'],
- g2 => ['accented'],
- g3 => ['latin'],
- g4 => ['other'],
- },
-});
+use Shiar_Sheet::Keyboard 2.08;
+my $keys = Shiar_Sheet::Keyboard->new($info);
$keys->map($get{map}) or undef $get{map};
-$keys->print_rows($get{rows}, [0]);
+$keys->print_rows($get{rows}, $info->{rows});
$keys->print_legends(\%get);