line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
######################################################## |
2
|
|
|
|
|
|
|
# Copyright © 2009 Six Apart, Ltd. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package HTML::Laundry::Rules::Minimal; |
5
|
3
|
|
|
3
|
|
2604
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
74
|
|
6
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
60
|
|
7
|
3
|
|
|
3
|
|
8
|
use base qw( HTML::Laundry::Rules ); |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
507
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
HTML::Laundry::Rules::Minimal - a minimal set of HTML attributes |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head2 acceptable_e |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Return a hashref representing a minimal list of acceptable elements: |
18
|
|
|
|
|
|
|
a, b, blockquote, code, em, i, li, ol, p, pre, strong, u, and ul |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub acceptable_e { |
23
|
4
|
|
|
4
|
1
|
6
|
my $self = shift; |
24
|
4
|
|
|
|
|
15
|
my @acceptable = qw( |
25
|
|
|
|
|
|
|
a b br blockquote code em i li ol p pre strong u ul |
26
|
|
|
|
|
|
|
); |
27
|
4
|
|
|
|
|
5
|
my %acceptable = map { ( $_, 1 ) } @acceptable; |
|
56
|
|
|
|
|
85
|
|
28
|
4
|
|
|
|
|
15
|
return \%acceptable; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 acceptable_a |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Return a hashref representing a list of acceptable attributes to support |
34
|
|
|
|
|
|
|
the minimal acceptable list ("href" only) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub acceptable_a { |
39
|
4
|
|
|
4
|
1
|
7
|
my $self = shift; |
40
|
|
|
|
|
|
|
my @acceptable |
41
|
4
|
|
|
|
|
8
|
= qw(href); |
42
|
4
|
|
|
|
|
6
|
my %acceptable = map { ( $_, 1 ) } @acceptable; |
|
4
|
|
|
|
|
17
|
|
43
|
4
|
|
|
|
|
15
|
return \%acceptable; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 allowed_schemes |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Return an arrayref representing "http" and "https" only |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub allowed_schemes { |
53
|
4
|
|
|
4
|
1
|
5
|
my $self = shift; |
54
|
|
|
|
|
|
|
return { |
55
|
4
|
|
|
|
|
14
|
http => 1, |
56
|
|
|
|
|
|
|
https => 1, |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |