}
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;
while (<XML>) {
if (/__print_map\((.*)\)/) {
my $map = $1;
+ my $maptitle = $1;
+ $maptitle =~ s/^(.)/\U$1\E/;
unless ($MAP{$map}) {
warn "map $map undefined";
next;
}
print <<EOT;
-<sect2 id="${map}_map">
-<title>$map</title>
+<sect2 id="${map}-map">
+<title>$maptitle Menu</title>
$DOC{$map}
-<para>
-<table id="${map}_table">
-<title>Default $map function bindings</title>
+<table id="${map}-table">
+<title>Default $map Function Bindings</title>
<tgroup cols="3">
<thead>
<row><entry>Function</entry><entry>Default key</entry><entry>Description</entry></row>
</tgroup>
</table>
-</para>
-
</sect2>
EOT
- delete $MAP{$1};
+ delete $MAP{$map};
} else {
print;
}