# $Date: 1997/05/15 16:06:29 $
system("/bin/cp $tocfile $tocfile.$$");
open(IN
, "$tocfile.$$") or die "Unable to open $tocfile\n";
open(OUT
, ">$tocfile") or die "Unable to create $tocfile\n";
if (/<!--X-TOC-Start-->/) {
last if (/<!--X-TOC-End-->/);
open(FILE
, $file) or die "Unable to open $file\n";
($id) = m
|name
="(.*?)"|i
;
s
|</?h\d.*?>||gi; s|</?a
.*?
>||gi
;
print OUT
qq{<li
><a name
="$id" href
="$file">$_</a
>\n<ul
>\n};
($id) = m
|name
="(.*?)"|i
;
s
|</?h\d.*?>||gi; s|</?a
.*?
>||gi
;
print OUT
qq{<li
><a name
="$id" href
="$file#$id">$_</a></li>\n};
print OUT
"</ul>\n</ul>\n";
print OUT
"<!--X-TOC-End-->\n";