#!/usr/bin/perl
# Adaptiert von Grisus heise.pl

use strict;
use diagnostics;

my $flag = 0;
my $golemtext="";
my $golemtext2="";

while (<>) {
    chomp;
    if ( ! $flag ) {
	if ( /<h[1-3] class=\"artikelhead\">/ ) { $flag = 1; }
        if ( /<p class=\"artikeltext\">/ || /<div class=\"artikeltext\">/ ) {
	    $flag = 1;
            $golemtext .= "<p align=\"center\">***</p>\n";
        }
    }
    if ( $flag ) {
#	if ( /<!-- BANNER -->/ ) {
	if ( /<!--\s*KOMMENTARE\s*-->/ ) {
	    $flag = 0;
	} else {
            if ( /(.*)<!\--\/content\--> *<a href=\"\/sonstiges\/impressum.html/ ) { 
	       $golemtext .= "$1";
               last ; 
            }
	    $golemtext .= "$_\n";
	}
    }
}

print "<html><body>" . $golemtext . "</body></html>\n";
