Diff for /loncom/build/doc_template.pl between versions 1.2 and 1.9

version 1.2, 2002/02/11 06:29:37 version 1.9, 2002/07/31 19:01:52
Line 1 Line 1
 # perl script  # doc_template.pl - A perl script for beautifying doc/build/*.html files
   
 # a quick and dirty xml reading and substitution  # (Quick and dirty xml reading and substitution.)
   
   # Scott Harrison
   
 # --------------------------------------- slurp in information  # --------------------------------------- slurp in information
 unless (scalar(@ARGV)==2) {  unless (scalar(@ARGV)==2) {
Line 9  unless (scalar(@ARGV)==2) { Line 11  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;
 my $title=$1;  my $title=$1;
 $t=~s/\<TITLE \/\>/$title/g;  $t=~s/\<TITLE \/\>/$title/g;
 $d=~/\$(.*?)\$/;  $d=~/\$(.*?)\$/;
 my $cvsdate="<i>CVS: $1</i>";  my $e=$1;
   $e=~s/\S*\s\S*\s+\S*$/ last updated/;
   my $cvsdate="<p align=\"left\"><font size=\"-2\"><i>CVS $e</i></font></p>";
 $t=~s/\<DATE \/\>/$cvsdate/g;  $t=~s/\<DATE \/\>/$cvsdate/g;
 $d=~/\<\!\-\- pdfahref (.*?) \-\-\>/;  $d=~/\<\!\-\- pdfahref (.*?) \-\-\>/;
 my $pdfahref="<a href='$1'>";  my $pdfahref="<a href='$1'>";
Line 73  END Line 79  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 align="right">
    <a href="http://validator.w3.org/check/referer"><img
           src="/loncapa_doc_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;

Removed from v.1.2  
changed lines
  Added in v.1.9


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>