1 | #!/kek/local/bin/perl |
---|
2 | # |
---|
3 | # Read in the data file |
---|
4 | # Print out HTML formatted lines |
---|
5 | # |
---|
6 | |
---|
7 | ###$file = 'node5.html' ; # Name the file |
---|
8 | $file = $ARGV[0]; # Name the file |
---|
9 | |
---|
10 | open(INFO, "<$file" ) ; # Open the file |
---|
11 | @lines = <INFO> ; # Read it into an array |
---|
12 | close(INFO) ; # Close the file |
---|
13 | |
---|
14 | $flag1 = 0; |
---|
15 | $flag2 = 0; |
---|
16 | $flagHead = 1; |
---|
17 | $flagNavigationPanel = 0; |
---|
18 | $flagTopNavigationPanel = 1; |
---|
19 | $flagReserve = 0; |
---|
20 | |
---|
21 | |
---|
22 | foreach $line (@lines) # assign @lines to $line, one at a time |
---|
23 | { # braces {} are required, bracket code |
---|
24 | |
---|
25 | |
---|
26 | if ($line =~ /<TITLE>Geant4 User's Guide/) |
---|
27 | { |
---|
28 | $flagReserve = 1; |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | if ($line =~ /BODY/) |
---|
33 | { |
---|
34 | $line = '<BODY> |
---|
35 | <TABLE WIDTH="100%"><TR> |
---|
36 | <TD>'; |
---|
37 | } |
---|
38 | |
---|
39 | if ($line =~ /--Navigation Panel--/ ) |
---|
40 | { |
---|
41 | $flagNavigationPanel = 1; |
---|
42 | } |
---|
43 | |
---|
44 | if ( $flagNavigationPanel == 1 ) |
---|
45 | { |
---|
46 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/next_motif.gif"#SRC="../../../resources/html/IconsGIF/Next.gif"#g; |
---|
47 | $line =~ s#IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"#IMG BORDER="0" ALT="next"#g; |
---|
48 | |
---|
49 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/up_motif.gif"#SRC="../../../resources/html/IconsGIF/Up.gif"#g; |
---|
50 | $line =~ s#IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"#IMG BORDER="0" ALT="up"#g; |
---|
51 | |
---|
52 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/previous_motif.gif"#SRC="../../../resources/html/IconsGIF/Previous.gif"#g; |
---|
53 | $line =~ s#IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"#IMG BORDER="0" ALT="previous"#g; |
---|
54 | |
---|
55 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/contents_motif.gif"#SRC="../../../resources/html/IconsGIF/Contents.gif"#g; |
---|
56 | $line =~ s#IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"#IMG BORDER="0" ALT="contents"#g; |
---|
57 | |
---|
58 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/next_motif_gr.gif"#SRC="../../../resources/html/IconsGIF/NextGR.gif"#g; |
---|
59 | $line =~ s#IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"#IMG BORDER="0" ALT="next"#g; |
---|
60 | |
---|
61 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/up_motif_gr.gif"#SRC="../../../resources/html/IconsGIF/UpGR.gif"#g; |
---|
62 | $line =~ s#IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"#IMG BORDER="0" ALT="up"#g; |
---|
63 | |
---|
64 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/previous_motif_gr.gif"#SRC="../../../resources/html/IconsGIF/PreviousGR.gif"#g; |
---|
65 | $line =~ s#IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"#IMG BORDER="0" ALT="previous"#g; |
---|
66 | |
---|
67 | $line =~ s#SRC="/usr/local/share/latex2html/icons.gif/contents_motif_gr.gif"#SRC="../../../resources/html/IconsGIF/ContentsGR.gif"#g; |
---|
68 | $line =~ s#IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"#IMG BORDER="0" ALT="contents"#g; |
---|
69 | |
---|
70 | } |
---|
71 | |
---|
72 | if ($line =~ /Next:/ ) |
---|
73 | { |
---|
74 | $flag1 = 1; |
---|
75 | } |
---|
76 | |
---|
77 | if ($line =~ /End of Navigation Panel/ ) |
---|
78 | { |
---|
79 | if ($flagTopNavigationPanel == 1) |
---|
80 | { |
---|
81 | $line = '</TD> |
---|
82 | <TD ALIGN="Right"> |
---|
83 | <FONT SIZE="-1" COLOR="#238E23"> |
---|
84 | <B>Geant4 User\'s Guide</B><BR> |
---|
85 | <B>For Toolkit Developers</B> |
---|
86 | </FONT> |
---|
87 | </TD> |
---|
88 | </TR></TABLE><BR> |
---|
89 | '; |
---|
90 | } |
---|
91 | |
---|
92 | $flagTopNavigationPanel = 0; |
---|
93 | $flagNavigationPanel = 0; |
---|
94 | $flag1 = 0; |
---|
95 | } |
---|
96 | |
---|
97 | if ($flag1 == 1) |
---|
98 | { |
---|
99 | $line = ""; |
---|
100 | } |
---|
101 | |
---|
102 | ###-------------- |
---|
103 | if ($line =~ /Table of Child-Links/ && $flagReserve == 0) |
---|
104 | { |
---|
105 | $flag2 = 1; |
---|
106 | } |
---|
107 | |
---|
108 | if ($line =~ /End of Table of Child-Links/ ) |
---|
109 | { |
---|
110 | $flag2 = 0; |
---|
111 | } |
---|
112 | |
---|
113 | if ($flag2 == 1) |
---|
114 | { |
---|
115 | $line = ""; |
---|
116 | } |
---|
117 | ###-------------- |
---|
118 | if ($flagHead == 1) |
---|
119 | { |
---|
120 | if ($line =~ /<HR>/) |
---|
121 | { |
---|
122 | $line =~ s!<HR>!!g; |
---|
123 | } |
---|
124 | if ($line =~ /<H1>/) |
---|
125 | { |
---|
126 | $line =~ s!<H1>!<BR><P ALIGN="Center"><FONT SIZE="+4" COLOR="#238E23"><B>!g; |
---|
127 | } |
---|
128 | |
---|
129 | if ($line =~ /H1 ALIGN/) |
---|
130 | { |
---|
131 | $line =~ s!<H1 ALIGN="CENTER">!<BR><P ALIGN="Center"><FONT SIZE="+4" COLOR="#238E23"><B>!g; |
---|
132 | } |
---|
133 | if ($line =~ /<\/H1>/) |
---|
134 | { |
---|
135 | $line =~ s!</H1>!</B></FONT><BR><P>!g; |
---|
136 | $flagHead = 0; |
---|
137 | } |
---|
138 | } |
---|
139 | ###-------------- |
---|
140 | |
---|
141 | if ($line =~ /<H2>/) |
---|
142 | { |
---|
143 | $line =~ s!<H2>!<HR><P><BR><H2>!g; |
---|
144 | } |
---|
145 | |
---|
146 | if ($line =~ /ADDRESS/ ) |
---|
147 | { |
---|
148 | $flag3 = 1; |
---|
149 | } |
---|
150 | |
---|
151 | if ($line =~ /\/ADDRESS/ ) |
---|
152 | { |
---|
153 | $flag3 = 0; |
---|
154 | } |
---|
155 | |
---|
156 | if ($flag3 == 1) |
---|
157 | { |
---|
158 | $line = ""; |
---|
159 | } |
---|
160 | |
---|
161 | $line =~ s/node1.html/toolkitDeveloper.html/g; |
---|
162 | |
---|
163 | |
---|
164 | print "$line" ; # print formatted lines to screen |
---|
165 | } |
---|
166 | |
---|
167 | # |
---|
168 | # DONE |
---|
169 | # |
---|
170 | |
---|
171 | |
---|
172 | |
---|