line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Template::Compiled::Plugin::HTML2; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Do not escape all HTML entities |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1064
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use HTML::Template::Compiled; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
HTML::Template::Compiled->register(__PACKAGE__); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
516
|
use HTML::Entities; |
|
1
|
|
|
|
|
5613
|
|
|
1
|
|
|
|
|
220
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub register{ |
16
|
1
|
|
|
1
|
1
|
17
|
my ($class) = @_; |
17
|
1
|
|
|
|
|
5
|
my %plugs = ( |
18
|
|
|
|
|
|
|
escape => { |
19
|
|
|
|
|
|
|
HTML_WITHOUT_NBSP => \&escape_html, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
3
|
return \%plugs; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub escape_html { |
27
|
7
|
|
|
7
|
1
|
17005
|
my ($str) = @_; |
28
|
|
|
|
|
|
|
|
29
|
7
|
100
|
|
|
|
42
|
return $str unless defined $str; |
30
|
|
|
|
|
|
|
|
31
|
6
|
|
|
|
|
20
|
$str = HTML::Entities::encode_entities( $str ); |
32
|
6
|
|
|
|
|
148
|
$str =~ s! ! !g; |
33
|
6
|
|
|
|
|
15
|
$str =~ s!<br />! !g; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#$str =~ s/&/&/g; |
36
|
|
|
|
|
|
|
#$str =~ s/"/"/g; |
37
|
|
|
|
|
|
|
#$str =~ s/'/'/g; |
38
|
|
|
|
|
|
|
#$str =~ s/>/>/g; |
39
|
|
|
|
|
|
|
#$str =~ s/</g; |
40
|
|
|
|
|
|
|
|
41
|
6
|
|
|
|
|
125
|
return $str; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |