projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ca1326b
)
SL::HTML::Util::strip: HTML-Entitäten zurückübersetzen
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:47:03 +0000
(13:47 +0200)
committer
Moritz Bunkus
<m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:47:29 +0000
(13:47 +0200)
SL/HTML/Util.pm
patch
|
blob
|
history
diff --git
a/SL/HTML/Util.pm
b/SL/HTML/Util.pm
index
7212d64
..
0b2e630
100644
(file)
--- a/
SL/HTML/Util.pm
+++ b/
SL/HTML/Util.pm
@@
-6,6
+6,11
@@
use warnings;
use HTML::Parser;
my %stripper;
+my %entities = (
+ 'lt' => '<',
+ 'gt' => '>',
+ 'amp' => '&',
+);
sub strip {
my ($class_or_value) = @_;
@@
-22,6
+27,8
@@
sub strip {
$stripper{parser}->parse($value);
$stripper{parser}->eof;
+ $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} }eg;
+
return delete $stripper{text};
}