# Std.pl, Jon Udell (jon_u@dev5.byte.com), BYTE, Copyright 1996 # # Assume "file.htm" contains this sequence of tags: # # # #

# # Then this command: # # perl std.pl file 0 # # includes standard boilerplate between the begin/end pair, and applies # standard attributes to the

tag's tag. # # (Use zero for white background, nonzero for offwhite.) # # file.htm is the new file. file.bak remembers the original. # header vars $tBackground = "[unarchived-media]" = ( $tBackground ? "\n" : "\n", "Home\n", "Articles\n", "Benchmarks\n", "Information\n", "Resources\n", "VPR\n", "
\n" ); $beginhdr = ""; $endhdr = ""; $in_hdr = 0; # title vars $ttltags = " align=left hspace=20"; $imgpat = "(]*)(.+)"; open(IN, "$ARGV[0].htm") || die "Cannot open $ARGV[0].htm"; while () { unless ( $in_hdr || (/$imgpat/) ) {push(@lines,$_);} if (/$beginhdr/) { $in_hdr = 1; @lines = (@lines,@stdhdr); } if (/$endhdr/) { {push(@lines,$_);} $in_hdr = 0; } if (/$imgpat/) { $ttl = sprintf("%s%s%s\n",$1,$ttltags,$3); push(@lines,$ttl); } } close (IN); unlink "$ARGV[0].bak"; rename ("$ARGV[0].htm", "$ARGV[0].bak"); open(OUT, ">$ARGV[0].htm") || die "Can't create $ARGV[0].htm"; foreach $line (@lines) { print OUT $line; } close OUT;