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

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

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