codebox.pl to HTML.

index -|- end

Generated: Tue Feb 2 17:54:27 2010 from codebox.pl 2005/05/15 1 KB.

#!/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;

index -|- top

checked by tidy  Valid HTML 4.01 Transitional