#!/usr/local/bin/perl -w # David MacKay # this takes the abstr.html of chris ford's # and adds an index to it (called head) such that every # heading is in the index and clickable # then cats the two together eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; # $file = $ARGV[0] ; $filehead = $file.".head"; $filetail = $file.".tail"; $filetwo = $file.".2"; $l=0; print $filehead." opening...\n" ; open ( HEAD , "> $filehead" ) ; open ( TAIL , "> $filetail" ) ; do { $_ = <>; print HEAD $_ ; # # HEAD } while ( !(/body/) ) ; print HEAD "html version generated by DJCM Oct 10 96\n"; while(<>){ s### ; s### ; if ( /

/ | /

/ | /<\/h2>/ | /<\/h3>/ ) { $head = $_ ; # print $head ; $tail = $_ ; # assume only one h2 or h3 in a line $head =~ s/\/

/ ; $head =~ s/\// ; $tail =~ s/\/

/ ; $tail =~ s/\/

/ ; $head =~ s#

#

# ; $head =~ s#

#
# ; $l ++ ; print HEAD $head ; print TAIL $tail ; } else { print TAIL $_ ; } } print HEAD "

\n" ; close(HEAD); close(TAIL); system "cat $filehead $filetail > $filetwo" ;