[LON-CAPA-cvs] cvs: loncom /build doc_template.pl
harris41
lon-capa-cvs@mail.lon-capa.org
Wed, 01 May 2002 22:15:37 -0000
harris41 Wed May 1 18:15:37 2002 EDT
Modified files:
/loncom/build doc_template.pl
Log:
supporting xhtml 1.0 transitional dtd validation
Index: loncom/build/doc_template.pl
diff -u loncom/build/doc_template.pl:1.5 loncom/build/doc_template.pl:1.6
--- loncom/build/doc_template.pl:1.5 Tue Apr 23 11:28:03 2002
+++ loncom/build/doc_template.pl Wed May 1 18:15:37 2002
@@ -9,9 +9,11 @@
my $template=shift @ARGV; my $data=shift @ARGV;
my @lines;
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");
-@lines=<IN>; close IN; $t=join('',@lines);
+@lines=<IN>; close IN;
+my $t=join('',@lines);
# ------- read in values from data
$d=~/\<title.*?\>(.*?)\<\/title.*?\>/s;
@@ -75,8 +77,25 @@
}
$d=~/\<\!\-\- preamble start \-\-\>(.*?)\<\!\-\- preamble end \-\-\>/s;
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;
$d=~/\<\!\-\- maintext start \-\-\>(.*?)\<\!\-\- maintext end \-\-\>/s;
my $maintext=$1;
$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;