Jitterbug no more.
[fvwm.git] / doc / util / genAllCommands.pl
blobabbf493cc12ce1acd80d218115b1132514b0d253
1 #!/usr/bin/perl -w
3 # $Id: genAllCommands.pl,v 1.1 2007/03/10 05:16:02 scott Exp $
5 # This script is used to generate HTML for the "allCommands.html" page.
6 # ./genAllCommands.pl cmds.txt
8 my $n=0;
9 my $bHTML = 1; # change me to 0 to set ASCII output.
10 my @obsolete = ('ColorLimit', 'GlobalOpts', 'HilightColor', 'HilightColorset', 'IconFont', 'IconPath', 'PixmapPath', 'Recapture', 'RecaptureWindow', 'WindowShadeAnimate', 'WindowFont', 'WindowsDesk');
11 # @deprecated is not currently used.
12 my @deprecated = ('AddToDecor', 'ChangeDecor', 'DestroyDecor', 'UpdateDecor');
13 while (<>)
15 if (/^--$/)
17 $n++;
19 else
21 chop();
22 push(@{$a[$n]}, $_);
26 my $maxRows = -1;
27 for (my $i = 0; $i <= $n; $i++)
29 my $rows = scalar(@{$a[$i]});
30 $maxRows = $rows if ($rows > $maxRows);
31 printf("column $i has $rows items.\n");
32 foreach (@{$a[$i]})
34 # printf(" $_\n");
37 printf("maxRows=$maxRows\n");
39 for (my $r = 0; $r < $maxRows; $r++)
41 printf("<tr>\n") if ($bHTML);
42 for (my $i = 0; $i <= $n; $i++)
44 my ($cmd, $prefix, $eek, $bObsolete) = ('n/a', '', '', 0);
45 if (defined $a[$i][$r])
47 $cmd = $a[$i][$r];
48 my $l = substr($cmd, 0, 1);
49 $bObsolete = grep(/^$cmd$/, @obsolete);
50 my $c = ($bObsolete ? "<font class=\"obsolete\">$cmd</font>" : $cmd);
51 $eek = "><a href=\"commands/$cmd.html\">$c</a";
52 if (!defined $letter{$l})
54 if ($bHTML)
56 $prefix = " align=\"right\"><b>$l&nbsp;</b";
58 else
60 $prefix = $l
63 $letter{$l} = 1;
67 if (!$bHTML)
69 $cmd .= '*' if ($bObsolete);
70 printf("%-2s%-21s ", $prefix, $cmd);
72 else
74 printf("<td$prefix></td><td$eek></td>\n");
77 printf("\n") if (!$bHTML);
78 printf("</tr>\n") if ($bHTML);