version 1.5, 2002/04/23 15:28:03
|
version 1.6, 2002/05/01 22:15:37
|
Line 9 unless (scalar(@ARGV)==2) {
|
Line 9 unless (scalar(@ARGV)==2) {
|
my $template=shift @ARGV; my $data=shift @ARGV; |
my $template=shift @ARGV; my $data=shift @ARGV; |
my @lines; |
my @lines; |
open IN,"<$data" or die("no file $data"); |
open IN,"<$data" or die("no file $data"); |
@lines=<IN>; close IN; $d=join('',@lines); |
@lines=<IN>; close IN; |
|
my $d=join('',@lines); |
open IN,"<$template" or die("no file $data"); |
open IN,"<$template" or die("no file $data"); |
@lines=<IN>; close IN; $t=join('',@lines); |
@lines=<IN>; close IN; |
|
my $t=join('',@lines); |
|
|
# ------- read in values from data |
# ------- read in values from data |
$d=~/\<title.*?\>(.*?)\<\/title.*?\>/s; |
$d=~/\<title.*?\>(.*?)\<\/title.*?\>/s; |
Line 75 END
|
Line 77 END
|
} |
} |
$d=~/\<\!\-\- preamble start \-\-\>(.*?)\<\!\-\- preamble end \-\-\>/s; |
$d=~/\<\!\-\- preamble start \-\-\>(.*?)\<\!\-\- preamble end \-\-\>/s; |
my $preamble=$1; |
my $preamble=$1; |
|
$preamble=~s/\<p([^\>]*)\>/<p$1><font face="helvetica">/g; |
|
$preamble=~s/\<\/p([^\>]*)\>/<\/font><\/p$1>/g; |
|
$preamble=~s/\<li([^\>]*)\>/<li$1><font face="helvetica">/g; |
|
$preamble=~s/\<\/li([^\>]*)\>/<\/font><\/li$1>/g; |
$t=~s/\<PREAMBLE \/\>/$preamble/g; |
$t=~s/\<PREAMBLE \/\>/$preamble/g; |
$d=~/\<\!\-\- maintext start \-\-\>(.*?)\<\!\-\- maintext end \-\-\>/s; |
$d=~/\<\!\-\- maintext start \-\-\>(.*?)\<\!\-\- maintext end \-\-\>/s; |
my $maintext=$1; |
my $maintext=$1; |
$t=~s/\<MAINTEXT \/\>/$maintext/g; |
$t=~s/\<MAINTEXT \/\>/$maintext/g; |
|
my $v=(<<END); |
|
<p> |
|
<a href="http://validator.w3.org/check/referer"><img |
|
src="http://www.w3.org/Icons/valid-xhtml10" |
|
alt="Valid XHTML 1.0!" height="31" width="88" /></a> |
|
</p> |
|
END |
|
if ($d=~/\<\!\-\- validated \-\-\>/) { |
|
$t=~s/\<VALIDATED \/\>/$v/g; |
|
} |
|
else { |
|
$t=~s/\<VALIDATED \/\>//g; |
|
} |
print $t; |
print $t; |