X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/4f3a0ab534d137dee45c52b3e9ae17f48e13f084..a13f2a9bd60851cbfd495dcff82871fd89ec9acc:/SL/HTML/Util.pm?ds=sidebyside diff --git a/SL/HTML/Util.pm b/SL/HTML/Util.pm index f68fb0a1f..a54425d83 100644 --- a/SL/HTML/Util.pm +++ b/SL/HTML/Util.pm @@ -27,7 +27,7 @@ sub strip { if (!%stripper) { %stripper = ( parser => HTML::Parser->new ); - $stripper{parser}->handler(text => sub { $stripper{text} .= $_[1]; }); + $stripper{parser}->handler(text => sub { $stripper{text} .= ' ' . $_[1]; }); } $stripper{text} = ''; @@ -35,6 +35,8 @@ sub strip { $stripper{parser}->eof; $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} || "\&$1;" }eg; + $stripper{text} =~ s{^ +| +$}{}g; + $stripper{text} =~ s{ {2,}}{ }g; return delete $stripper{text}; }