"Fossies" - the Fresh Open Source Software Archive

Member "html2sgml-0.3/extras/merg" (25 Aug 1997, 1242 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     
   19     
   20 $inhead = nej;
   21 $infoot = nej;
   22 $intable = nej;
   23 while (<>) {
   24     if (/<HTML>/i) {
   25         $inhead = ja;
   26     }
   27     if (/<BODY.*?>/i) {
   28         s/.*?<BODY.*?>//gi;
   29         $inhead = nej;  
   30     }
   31     if (/<\/BODY>/i) {
   32         $infoot = ja;
   33         if (/<\/HTML>/i) {
   34             $infoot = nej;
   35             s/.*<\/HTML>//gi;
   36         }
   37         s/<\/BODY>.*//gi;
   38         print ut;
   39         
   40     }
   41     if (/<\/HTML>/i) {
   42         s/.*<\/HTML>.*$//ig;
   43         $infoot = nej;
   44     }
   45     
   46     
   47     if (($inhead eq ja) or ($infoot eq ja)){
   48     
   49     } else {
   50         s/^.*?>previous<.*$//i;
   51         s/^.*?>next<.*$//i;
   52         s/^.*?>\ssection.<.*$//i;
   53         s/\t*//g;
   54         s/<!.*$//gi;
   55         s/^.*-->//gi;
   56         
   57         s//&aring;/g;
   58         s//&ouml;/g;
   59         s//&auml;/g;
   60         
   61         s//&Aring;/g;
   62         s//&Auml;/g;
   63         s//&Ouml;/g;
   64         
   65         s/(<H\d*>).*\">(.*?)<\/A>/\1\2/gi;
   66         if (!/<H\d*>/) {
   67             s/^>(.*<\/H\d*>)/\1/gi;
   68         }
   69         s/^(.+)<A\s/\1\n<A /gi;
   70         s/(HREF=\").*?(#[a-zA-A0-9]*\")/\1\2/gi;
   71         
   72         print ut;
   73         }
   74 }
   75 print ut "</BODY>\n";
   76 print ut "</HTML>\n";
   77 close ut;