Update copyright information for 2014 + correct Grml's notation style
[grml-gen-zshrefcard.git] / genrefcard.pl
index 8e028ff..057142e 100755 (executable)
@@ -2,7 +2,16 @@
 use strict;
 #{{{ readme
 ### Author: Frank Terbeck <ft@bewatermyfriend.org>
-### GPLv2
+###
+### This file is free software: you can redistribute it and/or modify
+### it under the terms of the GNU General Public License as published
+### by the Free Software Foundation, either version 3 of the License,
+### or (at your option) any later version.
+###
+### This file is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+### GNU General Public License for more details.
 ###
 ### generate grml zsh refcard.
 ### #v#: variables
@@ -355,6 +364,25 @@ sub __keybinding { #{{{
        #xprint(0, "!-> DEBUG: kbd: $kbd - value: $value - desc: $desc\n");
 
         push(@{ $data{"keybindings-$secmap[$sec]"} }, "\\command\{$kbd\}\{$desc\}");
+    } elsif ($input[$ln] =~ m!^.*bind2maps\s+([^-])+--\s+(.*)!) {
+        my ($maps, $rest) = ($1, $2);
+        my (@a) = split /\s+/, $rest, 2;
+        if ($a[0] ne q{-s}) {
+            push(@{ $data{"keybindings-$secmap[$sec]"} },
+                 "\\command\{$a[0]\}\{$desc\}");
+            return 1;
+        }
+        my $seq;
+        $rest = $a[1];
+        if ($rest =~ m!^'([^']+)'\s+!) {
+            $seq = $1;
+        } elsif ($rest =~ m!^"([^"]+)"\s+!) {
+            $seq = $1;
+        } else {
+            $seq = $rest;
+        }
+        $seq = demystify_keys($seq);
+        push(@{ $data{"keybindings-$secmap[$sec]"} }, "\\command\{$seq\}\{$desc\}");
     } else {
         return 0;
     }