| 1 | ######################################################## | ||
| 2 | # Copyright © 2009 Six Apart, Ltd. | ||
| 3 | |||
| 4 | package HTML::Laundry::Rules::Minimal; | ||
| 5 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use base qw( HTML::Laundry::Rules ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | ▶ | my $self = shift; |
|
Subroutine
acceptable_e: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | 4 | my @acceptable = qw( | |
| 25 | a b br blockquote code em i li ol p pre strong u ul | ||
| 26 | ); | ||
| 27 | 4 | my %acceptable = map { ( $_, 1 ) } @acceptable; | |
| 28 | 4 | 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 | ▶ | my $self = shift; |
|
Subroutine
acceptable_a: called CC=1 SCAR=0.0
Pod
documented
| |||
| 40 | my @acceptable | ||
| 41 | 4 | = qw(href); | |
| 42 | 4 | my %acceptable = map { ( $_, 1 ) } @acceptable; | |
| 43 | 4 | 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 | ▶ | my $self = shift; |
|
Subroutine
allowed_schemes: called CC=1 SCAR=0.0
Pod
documented
| |||
| 54 | return { | ||
| 55 | 4 | http => 1, | |
| 56 | https => 1, | ||
| 57 | }; | ||
| 58 | } | ||
| 59 | |||
| 60 | |||
| 61 | 4 | 1; | |