#!/usr/bin/perl # # from a list of files with comments, generate an html index page, and subsequent sectional pages # # author: lumchan open parens a t close parens gmail.com # $index="index.html"; $list="list"; $imageprefix="image"; $imagesuffix="html"; # as many colours as there are pages! @colors=("yellow", "green", "cyan", "pink", "lime", "orange", "red", "gray", "lightblue", "magenta", "gold", "black", "blue"); @colortabs=("green", "cyan", "pink", "lime", "orange", "red", "gray", "salmon", "gold", "magenta", "yellow", "white", "silver"); if( -e "$index" ) { system ( "rm $index" ); } # need to count how many pages we'll have first.. $listCount=0; open LISTFILE, "$list"; while() { if( /END/ ) { $listCount++; } } close LISTFILE; # start doing magic open LISTFILE, "$list"; open INDEXFILE, ">>$index"; print INDEXFILE "


Images from Adult Dance Camps in Virginia
"; # clear existing files $k=0; $i=0; $m=1; while( ) { if( /END/ ) { if( $i > 0 ) { $nextfile="$imageprefix$m.$imagesuffix"; $k=$i-1; $previousfile="$imageprefix$k.$imagesuffix"; $m++; } else { $k++; $m++; $nextfile="$imageprefix$m.$imagesuffix"; $previousfile=""; } # current file html content $newfile="$imageprefix$i.$imagesuffix"; if( -e "$newfile" ) { system( "rm $newfile" ); } open NEWFILE, ">>$newfile"; print NEWFILE "

Back to index   "; if( -e $previousfile ) { print NEWFILE "Previous   "; } if( -e $nextfile ) { print NEWFILE "Next"; } print NEWFILE "

"; print INDEXFILE "
"; print INDEXFILE ""; for($j=0;$j<@contents;$j++) { print NEWFILE "\n"; } print NEWFILE "
$newfile<\/a>
$comments[$j]
$comments[$j]
"; print NEWFILE "

Back to index   "; if( -e $previousfile ) { print NEWFILE "Previous   "; } if( -e $nextfile ) { print NEWFILE "Next"; } close NEWFILE; $i++; #increment counter for which image file for($j=0;$j<@contents;$j++) { delete $contents[$j]; #cleanup delete $comments[$j]; #cleanup } } else { chomp; ($filename, $comment) = split /\|/; push @contents, $filename; push @comments, $comment; } } close LISTFILE; print INDEXFILE "


Perl source code I wrote to generate this from a list of files.

Way back home..

"; close INDEXFILE;