+if ($html) {
+
+ @groups_sorted_by_number = sort { $group_numbering{$a} <=> $group_numbering{$b} } keys %group_numbering;
+
+ foreach $gk (@groups_sorted_by_number) {
+
+ if ($gk =~ /^m/) {
+ # mouse stuff - ignore
+ next;
+ }
+
+ # $bref is a reference to the array of arrays for this group
+ $bref = $group_bindings{$gk};
+
+ if (scalar @$bref > 1) {
+
+ $name = $group_names{$gk};
+ $name =~ s/\\linebreak.*//;
+ $name =~ s/\\&/&/;
+ $name =~ s/\$\\_\$/-/g;
+ $name =~ s/\\[a-z]+ //g;
+ $name =~ s/[{}]//g;
+ $name =~ s/\\par//g;
+
+ print "<h3>$name</h3>\n";
+
+ $gtext = $group_text{$gk};
+ $gtext =~ s/\\linebreak.*//;
+ $gtext =~ s/\\&/&/;
+ $gtext =~ s/\$\\_\$/-/g;
+ $gtext =~ s/\\[a-z]+ //g;
+ $gtext =~ s/[{}]//g;
+ $gtext =~ s/\\par//g;
+
+ if (!($gtext eq "")) {
+ print "$gtext\n\n";
+ }
+
+ # ignore the first entry, which was empty
+
+ shift (@$bref);
+
+ # set up the list
+
+ print "<dl class=\"bindings\">\n";
+
+ # sort the array of arrays by the descriptive text for nicer appearance,
+ # and print them
+
+ for $bbref (sort { @$a[1] cmp @$b[1] } @$bref) {
+ # $bbref is a reference to an array
+
+ $binding = @$bbref[0];
+ $text = @$bbref[1];
+
+ if ($binding =~ /:/) { # mouse binding with "where" clause
+ ($binding,$where) = split (/:/, $binding, 2);
+ }
+
+ foreach $k (keys %cs_modifier_map) {
+ $binding =~ s/\@$k\@/$cs_modifier_map{$k}/;
+ }
+
+ # remove braces for HTML
+
+ $binding =~ s/></\+/g;
+ $binding =~ s/^<//;
+ $binding =~ s/>/\+/;
+
+ # substitute keycode names for something printable
+
+ $re = qr/${ \(join'|', map quotemeta, keys %keycodes)}/;
+ $binding =~ s/($re)/$keycodes{$1}/g;
+
+ # tidy up description
+
+ $descr = @$bbref[1];
+ $descr =~ s/\\linebreak.*//;
+ $descr =~ s/\\&/&/;
+ $descr =~ s/\$\\_\$/-/g;
+ $descr =~ s/\\[a-z]+ //g;
+ $descr =~ s/[{}]//g;
+ $descr =~ s/\\par//g;
+
+ print "<dt>$descr</dt><dd>$binding</dd>\n";
+ }
+
+ print "</dl>\n";
+
+ }
+ }
+ print " <!-- remove this if more text is added below -->\n";
+ exit 0;
+}
+
+