#! /usr/local/bin/perl ##### # htmlgen-abc # Creates HTML files for calling files. Will sort them alphanumerically # from first point of difference. # Copyright (c) Matthew J. Walker 1995 # Free to distribute, modify, etc. as long as this head remains. ##### $date = `date` ; chop($date); ##### # Check to make sure files have been passed to the script. if (!@ARGV) { print <<"EOH"; Usage: htmlgen-abc [files] This script will package a series of .gif files into .html files that reference them. It will link the files in the order they are passed on the command line, so if a wildcard is used they are ordered alpha- numerically, a position at a time. ie 1-10 would be 1,10,2,3,4 etc. To get sequential numbering correct you must use htmlgen-num, or number 01,02,03 etc. EOH exit ; } # ##### foreach $i (0 .. $#ARGV) { $page = $i+1 ; ($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 Alphanumeric (c) Matthew J. Walker \n\n" ; sub CreateLinks { local($i, $j, $page, $file, $link_text) = @_ ; foreach $j (0 .. $#ARGV) { $page = $j+1 ; ($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 ; # inserts
every 6 } return $link_text ; }