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, 6 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.
1: # doc_template.pl - A perl script for beautifying doc/build/*.html files
2:
3: # (Quick and dirty xml reading and substitution.)
4:
5:
6: # --------------------------------------- slurp in information
7: unless (scalar(@ARGV)==2) {
8: die("invalid invocation of doc_template.pl");
9: }
10: my $template=shift @ARGV; my $data=shift @ARGV;
11: my @lines;
12: open IN,"<$data" or die("no file $data");
13: @lines=<IN>; close IN;
14: my $d=join('',@lines);
15: open IN,"<$template" or die("no file $data");
16: @lines=<IN>; close IN;
17: my $t=join('',@lines);
18:
19: # ------- read in values from data
20: $d=~/\<title.*?\>(.*?)\<\/title.*?\>/s;
21: my $title=$1;
22: $t=~s/\<TITLE \/\>/$title/g;
23: $d=~/\$(.*?)\$/;
24: my $e=$1;
25: $e=~s/\S*\s\S*\s+\S*$/ last updated/;
26: my $cvsdate="<p align=\"left\"><font size=\"-2\"><i>CVS $e</i></font></p>";
27: $t=~s/\<DATE \/\>/$cvsdate/g;
28: $d=~/\<\!\-\- pdfahref (.*?) \-\-\>/;
29: my $pdfahref="<a href='$1'>";
30: $t=~s/\<PDFAHREF \/\>/$pdfahref/g;
31:
32: my %bhash=(
33: 'CONFIGURE' => '/docs/reconfig/index.html',
34: 'INSTALL' => '/docs/install/index.html',
35: 'UPGRADE' => '/docs/upgrade/index.html',
36: 'FAQ' => '/docs/faq/index.html',
37: 'DOWNLOADS' => '/docs/downloads/index.html',
38: 'CONTACT' => '/docs/contact/index.html',
39: 'MAIN-SITE' => 'http://install.lon-capa.org',
40: 'LICENSE' => '/docs/license/index.html',
41: );
42:
43: $d=~/\<\!\-\- button (.*?) \-\-\>/;
44: my $buttonv=$1;
45: while (1) {
46: if ($t=~/\<BUTTON NAME=\'(.*?)\' \/\>/) {
47: my $bname=$1;
48: my $button;
49: my $bh=$bhash{$bname};
50: if ($buttonv eq $bname) {
51: $button=<<END;
52: <table cellpadding='5' cellspacing='0' border='3'><tr><td>
53: <a href='$bh'>
54: <font face='helvetica'>
55: <font color='#009900'>
56: $bname
57: </font>
58: </font>
59: </a>
60: </td></tr></table>
61: END
62: }
63: else {
64: $button=<<END;
65: <table cellpadding='5' cellspacing='0' border='1'><tr><td>
66: <a href='$bh'>
67: <strong><font face='helvetica'>
68: <font color='#009900'>$bname</font>
69: </font></strong></a>
70: </td></tr></table>
71: END
72: }
73: $t=~s/\<BUTTON NAME=\'$bname\' \/\>/$button/g;
74: }
75: else {
76: last;
77: }
78: }
79: $d=~/\<\!\-\- preamble start \-\-\>(.*?)\<\!\-\- preamble end \-\-\>/s;
80: my $preamble=$1;
81: $preamble=~s/\<p([^\>]*)\>/<p$1><font face="helvetica">/g;
82: $preamble=~s/\<\/p([^\>]*)\>/<\/font><\/p$1>/g;
83: $preamble=~s/\<li([^\>]*)\>/<li$1><font face="helvetica">/g;
84: $preamble=~s/\<\/li([^\>]*)\>/<\/font><\/li$1>/g;
85: $t=~s/\<PREAMBLE \/\>/$preamble/g;
86: $d=~/\<\!\-\- maintext start \-\-\>(.*?)\<\!\-\- maintext end \-\-\>/s;
87: my $maintext=$1;
88: $t=~s/\<MAINTEXT \/\>/$maintext/g;
89: my $v=(<<END);
90: <p align="right">
91: <a href="http://validator.w3.org/check/referer"><img
92: src="/loncapa_doc_icons/valid-xhtml10"
93: alt="Valid XHTML 1.0!" height="31" width="88" /></a>
94: </p>
95: END
96: if ($d=~/\<\!\-\- validated \-\-\>/) {
97: $t=~s/\<VALIDATED \/\>/$v/g;
98: }
99: else {
100: $t=~s/\<VALIDATED \/\>//g;
101: }
102: print $t;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>