keys: replace legends by generic function
[sheet.git] / keyboard.plp
index ac9df32e2edb716ed7aa0a2b347cc2c52a45aee3..92c2aa292cd05eadfe3233c70de40548568aecb2 100644 (file)
@@ -3,7 +3,7 @@
 Html({
        title => 'keyboard cheat sheet',
        version => '1.0',
-       stylesheet => [qw'light dark circus mono red terse'],
+       stylesheet => [qw( light dark circus mono red )],
        keys => 1,
 });
 
@@ -12,18 +12,9 @@ Html({
 
 <h2>normal mode (default)</h2>
 
-<ul id="rows">
-
-<li class="row">
-       <ul class="keys omni">
-       <li class="mo chr27" onclick="setmode()"><b>Esc</b> normal mode
-               <!-- not as static anymore, but never bothered; just see ^[ -->
-       </ul>
-</li>
-
 <:
-our %sign;
-use Shiar_Sheet::Keyboard 2;
+use Shiar_Sheet::Keyboard 2.07;
+
 my $usint = [
        [  'a' ..                                            'z'],
        [qw(Á B ¢ Ð É F G H Í J Œ Ø µ Ñ Ó Ö Ä ® § Þ Ú V Å X Ü Æ)],
@@ -35,57 +26,16 @@ my $usint = [
 my $keys = Shiar_Sheet::Keyboard->new({
        def => {
                '' => {
-                       map { $_ => [''] } @{ $usint->[0] }
+                       map { $_ => '' } @{ $usint->[0] }
                },
        },
        key => {
                map {
-                       my $i = ord($_) - ord('a');
-                       $_ => ["$usint->[1]->[$i]<br>$usint->[2]->[$i]"]
-               } 'a'..'z'
+                       $usint->[0]->[$_] => "$usint->[1]->[$_]<br>$usint->[2]->[$_]"
+               } 0 .. $#{ $usint->[0] }
        },
 });
 $keys->map($get{map}) or undef $get{map};
 $keys->print_rows($get{rows}, [0]);
-:>
-</ul>
-
-<hr>
-
-<div class="help">
-       <div class="left">
-               <dl class="legend legend-types">
-               <dt class="ci">info
-                       <dd>Info command: shows/does something without altering anything.
-               <dt class="pm">motion
-               <dt class="po">positioning
-                       <dd>Other movement (jumps, window (re)positioning).
-               <dt class="co">command
-                       <dd>Direct action command.
-               <dt class="mi">ins mode
-                       <dd>Enters Insert or Replace mode.
-               <dt class="mo">mode
-                       <dd>Enters a different mode.
-               <dt class="mv">vis mode
-                       <dd>Enters Visual or Select mode.
-               <dt class="me">key cmd
-                       <dd>Additional key commands (click for overview).
-               </dl>
-       </div>
-
-       <div class="right">
-               <dl class="legend legend-options">
-               </dl>
-
-               <ul class="legend legend-set">
-               <li>keyboard <strong>map</strong> is
-                       <:= $get{map} ? 'set to ' : '' :><em><:= $keys->{map} :></em>
-               <li><strong>keys</strong> are
-                       <em><:= $showkeys ? 'always shown' : 'hidden if unassigned' :></em><:=
-                               !exists $get{keys} && ' by default' :>
-               <li>default <strong>style</strong> is
-                       <:= defined $get{style} && 'set to ' :><em><:= $style :></em>
-               </ul>
-       </div>
-</div>
+$keys->print_legends(\%get);