"Fossies" - the Fresh Open Source Software Archive

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