File:
[LON-CAPA] /
loncom /
build /
doc_template.pl
Revision
1.10:
download - view:
text,
annotated -
select for diffs
Mon Feb 3 18:03:52 2003 UTC (21 years, 10 months ago) by
harris41
Branches:
MAIN
CVS tags:
version_2_9_X,
version_2_9_99_0,
version_2_9_1,
version_2_9_0,
version_2_8_X,
version_2_8_99_1,
version_2_8_99_0,
version_2_8_2,
version_2_8_1,
version_2_8_0,
version_2_7_X,
version_2_7_99_1,
version_2_7_99_0,
version_2_7_1,
version_2_7_0,
version_2_6_X,
version_2_6_99_1,
version_2_6_99_0,
version_2_6_3,
version_2_6_2,
version_2_6_1,
version_2_6_0,
version_2_5_X,
version_2_5_99_1,
version_2_5_99_0,
version_2_5_2,
version_2_5_1,
version_2_5_0,
version_2_4_X,
version_2_4_99_0,
version_2_4_2,
version_2_4_1,
version_2_4_0,
version_2_3_X,
version_2_3_99_0,
version_2_3_2,
version_2_3_1,
version_2_3_0,
version_2_2_X,
version_2_2_99_1,
version_2_2_99_0,
version_2_2_2,
version_2_2_1,
version_2_2_0,
version_2_1_X,
version_2_1_99_3,
version_2_1_99_2,
version_2_1_99_1,
version_2_1_99_0,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_12_X,
version_2_11_X,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
version_2_10_X,
version_2_10_1,
version_2_10_0_RC2,
version_2_10_0_RC1,
version_2_10_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
version_1_3_X,
version_1_3_3,
version_1_3_2,
version_1_3_1,
version_1_3_0,
version_1_2_X,
version_1_2_99_1,
version_1_2_99_0,
version_1_2_1,
version_1_2_0,
version_1_1_X,
version_1_1_99_5,
version_1_1_99_4,
version_1_1_99_3,
version_1_1_99_2,
version_1_1_99_1,
version_1_1_99_0,
version_1_1_3,
version_1_1_2,
version_1_1_1,
version_1_1_0,
version_1_0_99_3,
version_1_0_99_2,
version_1_0_99_1,
version_1_0_99,
version_1_0_3,
version_1_0_2,
version_1_0_1,
version_1_0_0,
version_0_99_5,
version_0_99_4,
version_0_99_3,
version_0_99_2,
version_0_99_1,
version_0_99_0,
loncapaMITrelate_1,
language_hyphenation_merge,
language_hyphenation,
conference_2003,
bz6209-base,
bz6209,
bz5969,
bz5610,
bz2851,
PRINT_INCOMPLETE_base,
PRINT_INCOMPLETE,
HEAD,
GCI_3,
GCI_2,
GCI_1,
BZ5971-printing-apage,
BZ5434-fox,
BZ4492-merge,
BZ4492-feature_horizontal_radioresponse,
BZ4492-feature_Support_horizontal_radioresponse,
BZ4492-Support_horizontal_radioresponse
best wishes to all.
# doc_template.pl - A perl script for beautifying doc/build/*.html files
# (Quick and dirty xml reading and substitution.)
# --------------------------------------- slurp in information
unless (scalar(@ARGV)==2) {
die("invalid invocation of doc_template.pl");
}
my $template=shift @ARGV; my $data=shift @ARGV;
my @lines;
open IN,"<$data" or die("no file $data");
@lines=<IN>; close IN;
my $d=join('',@lines);
open IN,"<$template" or die("no file $data");
@lines=<IN>; close IN;
my $t=join('',@lines);
# ------- read in values from data
$d=~/\<title.*?\>(.*?)\<\/title.*?\>/s;
my $title=$1;
$t=~s/\<TITLE \/\>/$title/g;
$d=~/\$(.*?)\$/;
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;
$d=~/\<\!\-\- pdfahref (.*?) \-\-\>/;
my $pdfahref="<a href='$1'>";
$t=~s/\<PDFAHREF \/\>/$pdfahref/g;
my %bhash=(
'CONFIGURE' => '/docs/reconfig/index.html',
'INSTALL' => '/docs/install/index.html',
'UPGRADE' => '/docs/upgrade/index.html',
'FAQ' => '/docs/faq/index.html',
'DOWNLOADS' => '/docs/downloads/index.html',
'CONTACT' => '/docs/contact/index.html',
'MAIN-SITE' => 'http://install.lon-capa.org',
'LICENSE' => '/docs/license/index.html',
);
$d=~/\<\!\-\- button (.*?) \-\-\>/;
my $buttonv=$1;
while (1) {
if ($t=~/\<BUTTON NAME=\'(.*?)\' \/\>/) {
my $bname=$1;
my $button;
my $bh=$bhash{$bname};
if ($buttonv eq $bname) {
$button=<<END;
<table cellpadding='5' cellspacing='0' border='3'><tr><td>
<a href='$bh'>
<font face='helvetica'>
<font color='#009900'>
$bname
</font>
</font>
</a>
</td></tr></table>
END
}
else {
$button=<<END;
<table cellpadding='5' cellspacing='0' border='1'><tr><td>
<a href='$bh'>
<strong><font face='helvetica'>
<font color='#009900'>$bname</font>
</font></strong></a>
</td></tr></table>
END
}
$t=~s/\<BUTTON NAME=\'$bname\' \/\>/$button/g;
}
else {
last;
}
}
$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 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;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>