#! /opt/bin/perl # ________________________________________________________________ # /\ /\ CyberWeb SoftWare: Internet Information Systems # -{-<*>-}- World-Wide Web # __\/_\/_________________________________________________________ # Author : Alan Richmond, $File = 'ht'; # Version : 1.999 # Purpose : Process ht files into HTML files. # Usage : ht [file-name] # Comment : Omit the '.ht' extension in the file-name. # If no file-name is given, 'index' is assumed. # Disclaimer: This software is provided freely on the understanding # that the Author will not be held responsible for any # problems arising from it's use, and that there is no # support except by agreement on a fee for services. # ________________________________________________________________ require '/opt/u/richmond/DEV/Software/Perl/ht_subs.pl'; # We log files on the Development Server that are run through ht but not # the files on the Public Server. Rather than have 2 seperate versions of # ht, we have added a check for an additional argument. The file name is always # the last argument. # If there are 2 arguments, don't log the file and get the file from the 2nd argument # otherwise, log the file and get the name from the 1st argument. if ($#ARGV == 1) { $logit = 0; $fna = 1; } else { $logit = 1; $fna = 0; } $file = $ARGV[$fna]; $file =~ s/\.ht$//; # strip trailing .ht $path = $file; # $path =~ s/[^\/]*$//; $path =~ s/[-\w\.]*$//; # print "FILE: $file PATH: $path\n"; $file = 'index' if !$file; @file = split (/\//, $file); $v{'file'} = $file[$#file]; $v{'File'} = $file; $bord = 0; $cellp = 8; $cells = 1; $xmpc = "#ffffcc"; $butbg = "gold"; $out = "$file.html"; $file .= ".ht"; # print "$file\n"; open ( HT, "<$file")||die "$file: $!"; open (OUT, ">$out")||die "$file: $!"; chmod 0764, $out; select OUT ; while () { # Parse Header chop ; /(\S+)\s*:\s*(.*)/; $name = $1; last if ($name eq 'Content') ; $value = $2; $v{$name} = $value; if (!$value) { while () { last if /^\t*\+\+\+$/; $v{$name} .= $_; } } } &Head (1); if ($v{'Class'} eq 'Nova' or $v{'Class'} eq 'Astro') { $b1 = "bgcolor=black"; $b2 = "bgcolor=navy"; } else { $b1 = "bgcolor=\"#9999cc\""; $b2 = "bgcolor=\"#cccccc\""; } while () { ¯o; } # Parse Content # # log the update in the file if ($logit) { ($date,$time) = &datime; open(CLOG, '>>/opt/u/richmond/Log/update.log')||die"No logfile";; print CLOG "$date $v{'url'} \n"; close(CLOG); } &Foot ; sub macro { $colbg = "lightblue"; $colfg = "black"; if (/^$/) { print "

Bibliography

\n"; } elsif (//i) { $xmp = 1; $pre = $`; $lin = $'; $lin =~ s/</&lt;/g; $lin =~ s/>/&gt;/g; $_ = $pre . "<Pre class=Xmp>" . $lin; #"<p><center><table border=$bord cellpadding=0 cellspacing=0><tr><th class=xmp align=left bgcolor=\"$xmpc\"><Pre class=Xmp>" . $lin; print ; while ($xmp) { $_ = <HT>; if (/<\/xmp>/i) { $xmp = 0; $pos = $'; $lin = $`; $lin =~ s/</&lt;/g; $lin =~ s/>/&gt;/g; $_ = $lin . '</Pre>' . $pos; # $_ = $lin . '</Pre></th></tr></table></center><p>' . $pos; } else { s/</&lt;/g; s/>/&gt;/g; } print ; } } else { # regular line. &Macros ; print ; } }