"Fossies" - the Fresh Open Source Software Archive

Member "html2sgml-0.3/extras/htmlmerg" (25 Aug 1997, 913 Bytes) of package /linux/misc/old/html2sgml-0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 # merg htlm-pages into one. Given as arg-list
    3 $utfil = "htmlmerg.html";
    4 
    5 if (-e "$utfil") {
    6     die "filen htmlmerg.html existerar redan";
    7     } else {
    8         
    9             open (ut, ">>$utfil");
   10 #print ut <<'End_off';
   11 print ut "<HTML>\n";
   12 print ut "<HEAD>\n";
   13 print ut "<TITLE></TITLE>\n";
   14 print ut "</HEAD>\n";
   15 print ut "<BODY>\n";
   16 #End_off
   17     }
   18 $inhead = nej;
   19 $infoot = nej;
   20 $intable = nej;
   21 while (<>) {
   22     if (/<HTML>/i) {
   23         $inhead = ja;
   24     }
   25     if (/<BODY.*?>/i) {
   26         s/.*?<BODY.*?>//gi;
   27         $inhead = nej;  
   28     }
   29     if (/<\/BODY>/i) {
   30         $infoot = ja;
   31         s/<\/BODY>.*//gi;
   32         print ut;
   33         
   34     }
   35     if (/<\/HTML>/i) {
   36         s/.*<\/HTML>.*$//ig;
   37         $infoot = nej;
   38     }
   39     
   40     if (/<TABLE.*?>/i) {
   41         $intable = ja;
   42     }
   43     if (/<\/TABLE.*?>/i) {
   44         $intable = nej;
   45         s/.*?<\/TABLE.*?>//gi;
   46     }
   47     if (($inhead eq ja) or ($infoot eq ja) or ($intable eq ja)){
   48     
   49     } else {
   50         print ut;
   51         }
   52 }
   53 print ut "</BODY>\n";
   54 print ut "</HTML>\n";
   55 close ut;