keyboard: fix empty key titles
[sheet.git] / keyboard.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'keyboard cheat sheet',
5         version => '1.0',
6         stylesheet => [qw( light dark circus mono red )],
7         keys => 1,
8 });
9
10 :>
11 <h1>keyboard cheat sheet</h1>
12
13 <h2>normal mode (default)</h2>
14
15 <:
16 use Shiar_Sheet::Keyboard 2;
17 my $usint = [
18         [  'a' ..                                            'z'],
19         [qw(Á B ¢ Ð É F G H Í J Œ Ø µ Ñ Ó Ö Ä ® § Þ Ú V Å X Ü Æ)],
20         [qw(á b © ð é f g h í j œ ø µ ñ ó ö ä ® ß þ ú v å x ü æ)],
21         [qw(Å ı Ç ð ´ ̉ ˝ ̣ ˆ ½  Þ ¾ ˜ Ø ∏ Œ ‰ / ˇ ¨ ◊ „ ˛ ¼ ¸)],
22         [qw(å ∫ ç ∂ ´ ƒ © ˙ ^ ∆ ° ¬ µ ~ ø π œ ® ß † ¨ √ ∑ ≈ ¥ Ω)],
23 ];
24
25 my $keys = Shiar_Sheet::Keyboard->new({
26         def => {
27                 '' => {
28                         map { $_ => '' } @{ $usint->[0] }
29                 },
30         },
31         key => {
32                 map {
33                         $usint->[0]->[$_] => "$usint->[1]->[$_]<br>$usint->[2]->[$_]"
34                 } 0 .. $#{ $usint->[0] }
35         },
36 });
37 $keys->map($get{map}) or undef $get{map};
38 $keys->print_rows($get{rows}, [0]);
39 :>
40 <hr>
41
42 <div class="help">
43         <div class="right">
44                 <ul class="legend legend-set">
45                 <li>keyboard <strong>map</strong> is
46                         <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
47                 <li><strong>keys</strong> are
48                         <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
49                                 !exists $get{keys} && ' by default' :>
50                 <li>default <strong>style</strong> is
51                         <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
52                 </ul>
53         </div>
54 </div>
55