#! /usr/local/bin/perl ##### # htmlgen-num Creates HTML files for calling sequentially # numbered files. Expects files to be in a subordinate images directory. # Copyright (c) Matthew J. Walker 1995 ##### $date = `date` ; chop($date); ##### # Check to make sure files have been passed to the script. if (!@ARGV) { print <<"EOH"; Usage: htmlgen-num [files] Expects gif files to be sequentially numbered, with the page being the last field, preferably separated by a -, ala xxx-1-1.gif. These files should reside in an images directory. Html generated will be placed in the ../ directory. So, for 132AH, images in /132AH/images will be processed and the .html generated will be placed in /132AH/. \n Works for up to 20 files. EOH exit ; } # ##### # here we hack like mad to get the order right.... $page = 0 ; $skips = $#ARGV-8 ; if ($skips > 0) { $skipsp = $skips+1 ; @order = (0,$skipsp .. $#ARGV,1 .. $skips) ; } else { @order = (0 .. $#ARGV) ; } foreach $i (@order) { ++$page ; ($file = $ARGV[$i]) =~ s/gif/html/ ; #name of new html file ($title = $file) =~ s/\.html// ; #title of new html file in html $link_text = &CreateLinks($i); print "$file is being processed \n"; open(FILE, ">../$file") || die " Could not open $file for write!\n" ; print FILE <<"EOF" ; VOH // $title

$title

Page $page
$link_text
Last revision: $date
EOF close HTML ; } print "Done Processing \nHTML-Generator Numeric(c) Matthew J. Walker \n\n" ; sub CreateLinks { local($i, $j, $page, $file, $link_text) = @_ ; $page = 0 ; foreach $j (@order) { ++$page ; ($file = $ARGV[$j]) =~ s/gif/html/ ; #name of new html file if ($i == $j) { $link_text .= "[Page $page]\n"; } else { $link_text .= "[Page $page]\n"; } $link_text .= "
\n" unless $page%6 ; } return $link_text ; }