keyboard: report code errors in altgr includes
[sheet.git] / keyboard.plp
1 <(common.inc.plp)><:
2
3 my $mode = lc($Request || 'altgr');
4 my $include = "$mode.eng";
5
6 my $info = eval { Data($include) } || {};
7 warn "error in $include: ", @{$@} if ref $@;
8 $mode = $info->{title} // $mode;
9
10 Html({
11         title => "\L$mode\E keyboard cheat sheet",
12         version => $info->{version} || '0.1',
13         description => $info->{description} //
14                 ["Keyboard cheat sheet for the default controls of $mode."],
15         keywords => [@{ $info->{keywords} // [] }, qw'
16                 sheet cheat reference overview keyboard control commands shortkey
17         '],
18         stylesheet => [qw( light dark circus mono red )],
19         keys => 1,
20         data => ["$include.inc.pl"],
21 });
22
23 %{$info} or Abort(
24         "Requested keyboard <q>$mode</q> not available",
25         '404 request not found',
26 );
27
28 say "<h1>$mode cheat sheet</h1>";
29 say "<p>$_</p>" for $info->{intro} // ();
30 say "<h2>", $info->{mode}->{''}, " (default)</h2>"
31         if $info->{mode} and %{ $info->{mode} } > 1;
32
33 use Shiar_Sheet::Keyboard 2.08;
34 my $keys = Shiar_Sheet::Keyboard->new($info);
35 $keys->map($get{map}) or undef $get{map};
36 $keys->print_rows($get{rows}, $info->{rows});
37 $keys->print_legends(\%get);
38