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