#!/usr/bin/perl -w
# htmlweg.pl - Entfernt HTML-Code aus Textdateien, beachtet aber bestimmte
#            - Formatierungen
# Copyright (C) 2001 by Ingo Blechschmidt
# Sam Jun 16 13:09:43 MEST 2001
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Ingo Blechschmidt
# Arberstraße 5
# 86179 Augsburg
# E-Mail: iblech@web.de, http://www.way.to/uselinux/
# Tel.: +49 / 821 882955
#
# 


@html = <STDIN>;

open (OUT, "|grep -v table | grep -vw tr | grep -wv td | grep -vw th") ||
  die "./htmlweg.pl: Kann keine Verbindung mit sort (ich meine grep) herstellen!";

foreach $h (@html) {
  $h =~ s/<img src=.*. \/>/---------------- Bild --------------/g;
  # $h =~ s/<br \/>/\\n/g;
  $h =~ s/<br \/>//g;
  $h =~ s/&auml;/ä/g;
  $h =~ s/&ouml;/ö/g;
  $h =~ s/&uuml;/ü/g;
  $h =~ s/&Auml;/Ä/g;
  $h =~ s/&Uuml;/Ü/g;
  $h =~ s/&Ouml;/Ö/g;
  $h =~ s/&szlig;/ß/g;
  $h =~ s/<a href=/siehe </g;
  $h =~ s/>*<\/a>//g;
  $h =~ s/<em>//g;
  $h =~ s/<\/em>//g;
  $h =~ s/<ol>|<\/ol>|<ul>|<\/ul>|<\/li>//g;
  $h =~ s/<ol>|<\/ol>|<ul>|<\/ul>|<\/li>//g;
  $h =~ s/<li>/* /g;
  $h =~ s/<span bgcolor=.#FFFFAA.><code>//g;
  $h =~ s/<.code><.span>//g;
  $h =~ s/<pre>//g;
  $h =~ s/<\/pre>//g;
  $h =~ s/&quot;/"/g;
  $h =~ s/<strong>//g;
  $h =~ s/<\/strong>//g;
  $h =~ s/<i>//g;
  $h =~ s/<\/i>//g;
  $h =~ s/<u>//g;
  $h =~ s/<\/u>//g;
  $h =~ s/&gt;/>/g;
  $h =~ s/&lt;/</g;
#  $h =~ s/<.+?>/ /s;
  $h =~ s/&nbsp;/ /g;
  $h =~ s/&amp;/&/g;
  $h =~ s/&lt;.+?&gt;/ /s;
  print OUT $h;
}

close(OUT);

