}
if ($map and /{\s*"(.+)"\s*,\s*(\w+)\s*,\s*(?:"([^"]+)"|(\w+))\s*}/) {
my ($function, $op, $binding) = ($1, $2, $3 || $4);
- $binding =~ s/ /Space/;
- $binding =~ s/^\\033/ESC /;
- $binding =~ s/^\\010/Backspace/;
- $binding =~ s/^\\(0\d+)$/'^'.chr(64+oct($1))/e;
- $binding =~ s/^\\(0\d+)(.)/'^'.chr(64+oct($1)) ." $2"/e;
- $binding =~ s/<(.+)>/$1/;
$binding =~ s/&/&/;
+ # for <key>, try CamelCasing into <Key>
+ $binding =~ s/<(.)(.+)>/<\U$1\E$2>/;
$binding =~ s/</</;
$binding =~ s/>/>/;
- $binding =~ s/\\t/TAB/;
- $binding =~ s/M_ENTER_S/RET/;
- $binding =~ s/NULL/not bound/;
+ $binding =~ s/ /<Space>/;
+ $binding =~ s/^\\033/Esc /;
+ $binding =~ s/^\\010/<Backspace>/;
+ $binding =~ s/^\\(0\d+)$/'^'.chr(64+oct($1))/e;
+ $binding =~ s/^\\(0\d+)(.)/'^'.chr(64+oct($1)) ." $2"/e;
+ $binding =~ s/\\t/<Tab>/;
+ $binding =~ s/M_ENTER_S/<Return>/;
+ $binding =~ s/NULL//;
die "unknown key $binding" if $binding =~ /\\[^\\]|<|>/;
die "unknown OP $op" unless $OPS{$op};
- $MAP{$map} .= "<row><entry>$function</entry><entry>$binding</entry><entry>$OPS{$op}</entry></row>\n";
+ $MAP{$map} .= "<row><entry><literal><$function></literal></entry><entry>$binding</entry><entry>$OPS{$op}</entry></row>\n";
}
if ($map and /^}/) {
undef $map;
}
print <<EOT;
<sect2 id="${map}_map">
-<title>$map</title>
+<title>$map menu</title>
$DOC{$map}
-<para>
<table id="${map}_table">
<title>Default $map function bindings</title>
</tgroup>
</table>
-</para>
-
</sect2>
EOT