#!/Perl

# This file generated using Dave's CODEBOX preprocessor ...
# perl program to convert files containing Dave's codebox tag to 
# straight HTML.
#
# Tags supported (so far)
# <CODEBOX> becomes a table containing PRE (in a single cell).
# <SCODE> becomes small code (8 pt).
$deffile = 'template.htm';
$backgroundcolor = "white";

$infile = shift || $deffile;

# do the whole thing at once !
open INPUT, "<$infile" or die "Can not locate DEFAULT file $deffile ...\n";
@lines = <INPUT>; # slurp whole file
close INPUT;
# do it all in public space ;=))
$_ = join("",@lines);

s/<CODEBOX>/<P><CENTER><TABLE BORDER=1 BGCOLOR=$backgroundcolor CELLPADDING=10><TR><TD><PRE>/g;
s/<\/CODEBOX>/<\/PRE><\/TD><\/TR><\/TABLE><\/CENTER><P>/g;

s/<SCODE>/<CODE class=small>/g;
s/<\/SCODE>/<\/CODE>/g;


# now get rid of the comment at the top of the file (if any)
s/<!--CODEBOX.*CODEBOX-->//s;
print "<!-- This file generated using Dave's CODEBOX preprocessor. -->\n\n";

print;

