X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/0d12df6dc721dcdbc81ca8db667cd644393bc5fc..f85be296b9862788320bc90ae34eb2c8c0db4b9e:/SL/HTML/Util.pm 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}; }