#!/usr/local/bin/perl
# Create HTML index from index of pre-installed info page.
# Bug: the @code{} items get lost, too bad.
open(IN, "info -f ./gri.info 'Index of Commands' |") 
    ||  die "Cannot get 'Index of Commands'\n";
# Following is kludge, really
print "
\@c HTML <!-- newfile CommandIndex.html \"Gri: Command Index\" \"Command Index\" -->
\@c HTML <h1>Command index</h1>
\@node   Index of Commands, Index of Builtins, License, Top

\@c HTML <b>Navigation</b>:
\@c HTML <a href=\"#BuiltinIndex\">next</a>,
\@c HTML <a href=\"#ConceptIndex\">previous</a>,
\@c HTML <a href=\"#Top\">parent</a>.

\@itemize \@bullet
";

while(<IN>) {
    next if (/\*\s*Menu:\s*$/);
    if (/\* .*\./) {
        s/\* //;
        s/\.$//;
        s/:\s*/\n ... \@xref{/;
        s/$/}./;
        print "\@item\n $_";
    }
}
print "\n\@end itemize\n";
#print "\n\@c HTML Dan Kelley\n";
