2004-04-17 02:40:00 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
#########!/msrc/apps/bin/perl
|
1998-03-19 14:21:41 +00:00
|
|
|
#
|
|
|
|
|
# New frames code to eat latex2html output and write a frames document
|
|
|
|
|
#
|
|
|
|
|
# Ricky A. Kendall
|
|
|
|
|
#
|
|
|
|
|
# 3/19/98
|
|
|
|
|
#
|
2010-10-29 18:04:21 +00:00
|
|
|
# $Id$
|
1998-03-24 00:36:27 +00:00
|
|
|
#
|
|
|
|
|
# remove nwchem banner stuff 3/23/98
|
1998-03-19 14:21:41 +00:00
|
|
|
#
|
2004-04-17 02:40:00 +00:00
|
|
|
###@INC = ("/msrc/apps/perl-5.005/lib/5.00502","/usr/lib/perl5");
|
1999-08-02 23:18:29 +00:00
|
|
|
require File::Copy;
|
1998-03-19 14:21:41 +00:00
|
|
|
|
|
|
|
|
if (($ARGV[0] eq "") || ($ARGV[1] eq "")) {
|
|
|
|
|
print "Usage: write_frames.pl document_name title_string\n";
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$document = $ARGV[0];
|
|
|
|
|
$title = $ARGV[1];
|
|
|
|
|
}
|
|
|
|
|
# figure_out where directory is:
|
|
|
|
|
#
|
|
|
|
|
$okay = 0;
|
|
|
|
|
if (-d "$document") {$okay++;}
|
|
|
|
|
if (-e "$document/index.html"){$okay++;}
|
|
|
|
|
if (-e "$document/$document.html"){$okay++;}
|
|
|
|
|
#print "okay is $okay \n";
|
|
|
|
|
if ($okay != 3) {
|
|
|
|
|
print "write_frames.pl: you must be running in the latex source directory\n";
|
|
|
|
|
print " where the latex2html directory $document exists\n\n";
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
if ($document eq "user") {
|
2003-04-17 23:00:43 +00:00
|
|
|
$bodystring = "<BODY BGCOLOR=\"#FFFFFF\">\n";
|
1998-03-19 14:21:41 +00:00
|
|
|
}
|
|
|
|
|
elsif ($document eq "prog") {
|
2003-04-17 23:00:43 +00:00
|
|
|
$bodystring = "<BODY BGCOLOR=\"#FFFFFF\">\n";
|
1998-03-19 14:21:41 +00:00
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$bodystring = "<BODY>\n";
|
|
|
|
|
}
|
|
|
|
|
# write index.html (frames document)
|
|
|
|
|
if (!(open(FINDEX,">$document/index.html"))){
|
|
|
|
|
die "write_frames.pl: could not open index.html for writing\n";
|
|
|
|
|
}
|
|
|
|
|
print FINDEX "<HTML>\n<HEAD>\n<TITLE> $title </TITLE>\n</HEAD>\n";
|
|
|
|
|
print FINDEX "<FRAMESET COLS=\"2*,5*\">\n";
|
|
|
|
|
print FINDEX " <FRAMESET ROWS=\"3*,5*\">\n";
|
|
|
|
|
print FINDEX " <FRAME SRC=\"$document.search.html\">\n";
|
|
|
|
|
print FINDEX " <FRAME SRC=\"contents.html\">\n";
|
|
|
|
|
print FINDEX " </FRAMESET>\n";
|
1998-03-24 00:36:27 +00:00
|
|
|
#-noban#print FINDEX " <FRAMESET ROWS=\"2*,10*\">\n";
|
|
|
|
|
#-noban#print FINDEX " <FRAME SRC=\"banner.html\">\n";
|
|
|
|
|
print FINDEX " <FRAMESET>\n";
|
1998-03-19 14:21:41 +00:00
|
|
|
print FINDEX " <FRAME SRC=\"$document.html\" NAME=\"main\">\n";
|
|
|
|
|
print FINDEX " </FRAMESET>\n";
|
|
|
|
|
print FINDEX "</FRAMESET>\n";
|
|
|
|
|
print FINDEX "</HTML>\n";
|
|
|
|
|
close(FINDEX);
|
1998-03-24 00:36:27 +00:00
|
|
|
#-noban## write banner.html
|
|
|
|
|
#-noban#if (!(open(FBAN,">$document/banner.html"))){
|
|
|
|
|
#-noban# die "write_frames.pl: could not open banner.html for writing\n";
|
|
|
|
|
#-noban#}
|
|
|
|
|
#-noban#print FBAN "<HTML>\n<HEAD>\n<TITLE> NWChem logo </TITLE>\n</HEAD>\n";
|
|
|
|
|
#-noban#print FBAN "<BODY BGCOLOR=\"aqua\">\n<CENTER>\n<P>\n";
|
|
|
|
|
#-noban#print FBAN "<IMG SRC=\"/docs/nwchem/nwchem_logo.gif\" ";
|
|
|
|
|
#-noban#print FBAN " ALT=\"NWChem - computational chemistry on parallel computers\"> \n";
|
|
|
|
|
#-noban#print FBAN "</P>\n<HR>\n</CENTER>\n</BODY>\n</HTML>\n";
|
|
|
|
|
#-noban#close(FBAN);
|
|
|
|
|
#
|
1998-03-19 14:21:41 +00:00
|
|
|
# write $document_search.html
|
|
|
|
|
if (!(open(FHTMLSEARCH,">$document/$document.search.html"))){
|
|
|
|
|
die "write_frames.pl: could not open $document/$document.search.html for writing\n";
|
|
|
|
|
}
|
|
|
|
|
if (!(open(FSEARCH,"$document.search"))){
|
1999-08-02 23:18:29 +00:00
|
|
|
die "write_frames.pl: could not open $document.search for reading(1)\n";
|
1998-03-19 14:21:41 +00:00
|
|
|
}
|
|
|
|
|
print FHTMLSEARCH "<HTML>\n<HEAD>\n<TITLE> $title Search Window</TITLE>\n";
|
1998-04-29 23:52:31 +00:00
|
|
|
print FHTMLSEARCH "<BASE TARGET=\"main\">\n";
|
1998-03-19 14:21:41 +00:00
|
|
|
print FHTMLSEARCH "</HEAD>\n";
|
|
|
|
|
print FHTMLSEARCH "$bodystring";
|
|
|
|
|
while (<FSEARCH>){
|
|
|
|
|
print FHTMLSEARCH $_;
|
|
|
|
|
}
|
|
|
|
|
print FHTMLSEARCH "<A TARGET=\"_TOP\" HREF=\"$document.html\"> No Frames Version </A><HR>";
|
|
|
|
|
print FHTMLSEARCH "\n</BODY>\n</HTML>\n";
|
|
|
|
|
close(FHTMLSEARCH);
|
|
|
|
|
close(FSEARCH);
|
|
|
|
|
# write contents.html (Contents are in a block that
|
|
|
|
|
# starts with: <!--Table of Contents--> and
|
|
|
|
|
# ends with : <!--End of Table of Contents-->
|
|
|
|
|
# this is usually in node2.html. This is assumed
|
|
|
|
|
#
|
|
|
|
|
if (!(open(FHTMLCONT,">$document/contents.html"))){
|
|
|
|
|
die "write_frames.pl: could not open $document/contents.html for writing\n";
|
|
|
|
|
}
|
2000-12-05 01:57:17 +00:00
|
|
|
if ($document eq "user") {
|
|
|
|
|
if (!(open(FCONT,"$document/node2.html"))){
|
|
|
|
|
die "write_frames.pl: could not open $document/node2.html for reading(2)\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($document eq "prog") {
|
|
|
|
|
if (!(open(FCONT,"$document/node4.html"))){
|
1999-08-02 23:18:29 +00:00
|
|
|
die "write_frames.pl: could not open $document/node2.html for reading(2)\n";
|
2000-12-05 01:57:17 +00:00
|
|
|
}
|
1998-03-19 14:21:41 +00:00
|
|
|
}
|
|
|
|
|
print FHTMLCONT "<HTML>\n<HEAD>\n<TITLE><B>Contents of $title </B></TITLE>\n";
|
|
|
|
|
print FHTMLCONT "<BASE TARGET=\"main\">\n</HEAD>\n";
|
|
|
|
|
print FHTMLCONT "<BR>\n<B>Contents of<br> $title </B><BR>\n";
|
|
|
|
|
print FHTMLCONT "$bodystring";
|
|
|
|
|
$printit = 0;
|
|
|
|
|
$printdone = 0;
|
|
|
|
|
while(<FCONT>){
|
|
|
|
|
if (!($printdone)){
|
|
|
|
|
if (/<!--Table of Contents-->/) {$printit = 1;}
|
|
|
|
|
if (/<!--End of Table of Contents-->/) {$printit = 0;$printdone=1;}
|
|
|
|
|
if ($printit) {print FHTMLCONT $_;}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print FHTMLCONT "</BODY>\n</HTML>\n";
|
|
|
|
|
close(FHTMLCONT);
|
|
|
|
|
close(FCONT);
|
|
|
|
|
# fix No Title
|
|
|
|
|
chdir $document;
|
1999-08-02 23:18:29 +00:00
|
|
|
$tmp = "tmp_$$";
|
|
|
|
|
#print "tmp is $tmp \n";
|
1998-03-19 14:21:41 +00:00
|
|
|
foreach $file (`ls -1 *.html`) {
|
1999-08-02 23:18:29 +00:00
|
|
|
chop($file);
|
1998-03-19 14:21:41 +00:00
|
|
|
if (-e "$tmp") {unlink $tmp || die "could not delete $tmp\n";}
|
1999-08-02 23:18:29 +00:00
|
|
|
# print "file: <: $file :>\n";
|
|
|
|
|
# print "tmp is <: $tmp :> \n";
|
|
|
|
|
$result_cp = ` /bin/cp $file $tmp `;
|
|
|
|
|
# perl copy seems to be broke ??
|
|
|
|
|
# copy($file,$tmp);
|
|
|
|
|
# $result_ls = `ls -l $tmp `;
|
|
|
|
|
# print $result_ls;
|
|
|
|
|
# exit;
|
1998-03-19 14:21:41 +00:00
|
|
|
$Ofile = '>' . $file;
|
|
|
|
|
open(FO,$Ofile) || die " could not open $Ofile for writting \n";
|
1999-08-02 23:18:29 +00:00
|
|
|
open(FI,$tmp) || die " could not open $tmp for reading(3) \n";
|
1998-03-19 14:21:41 +00:00
|
|
|
while (<FI>) {
|
|
|
|
|
if (/No Title/) {
|
|
|
|
|
$line = chop();
|
|
|
|
|
$line =~ s/No Title/$title/;
|
|
|
|
|
print FO "$line \n";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
print FO $_;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
close(FO);close(FI);
|
|
|
|
|
}
|
|
|
|
|
if (-e "$tmp") {unlink $tmp || die "could not delete $tmp\n";}
|
|
|
|
|
exit(0);
|