#!/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 Builtins' |") 
    ||  die "Cannot get 'Index of Builtins'\n";

print "
\@c HTML <!-- newfile BuiltinIndex.html \"Gri: Builtin Index\" \"Builtin Index\" -->
\@c HTML <h1>Builtin index</h1>
\@node   Index of Builtins, Concept Index, Index of Commands, Top

\@c HTML <b>Navigation</b>:
\@c HTML <a href=\"#Top\">next</a>,
\@c HTML <a href=\"#CommandIndex\">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";
