#!/usr/local/bin/perl -w # David MacKay # this takes the lit_rev.html of David Ward # 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=1; print $filehead." opening...\n" ; open ( HEAD , "> $filehead" ) ; open ( TAIL , "> $filetail" ) ; do { $_ = <>; print HEAD $_ ; # # HEAD } while ( !(/drw1/) ) ; print HEAD "
html index generated by DJCM Oct 11 96
\n"; while(<>){ s### ; if ( /
/ | /<\/H5>/ ) { $head = $_ ; # print $head ; $tail = $_ ; # assume only one h2 or h3 in a line $head =~ s/\/
  • / ; $tail =~ s/\/

    / ; $tail =~ s#

    #
  • # ; $head =~ s##
    # ; $head =~ s#
    ##g; $head =~ s#
    ##g; $l ++ ; print HEAD $head ; print TAIL $tail ; } else { print TAIL $_ ; } } print HEAD "

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