line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Unorderedlist; |
2
|
2
|
|
|
2
|
|
1141
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
2
|
|
|
2
|
|
|
2
|
|
48
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
|
2
|
|
|
|
|
41
|
|
|
2
|
|
|
|
|
1
|
|
|
2
|
|
|
|
|
65
|
|
3
|
2
|
|
|
2
|
|
6
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'unordered_list'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
|
|
|
|
|
|
sub filter |
9
|
|
|
|
|
|
|
{ |
10
|
4
|
|
|
4
|
0
|
7
|
my($self, $filter_manager, $value, $context ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
4
|
50
|
0
|
|
|
9
|
die $self->get_render_error( |
|
|
|
0
|
|
|
|
|
13
|
|
|
|
|
|
|
$context, |
14
|
|
|
|
|
|
|
sprintf( |
15
|
|
|
|
|
|
|
"Argument must be an ARRAY reference, not %s (%s)" |
16
|
|
|
|
|
|
|
, $value // 'undef' |
17
|
|
|
|
|
|
|
, ref $value || 'SCALAR' |
18
|
|
|
|
|
|
|
) |
19
|
|
|
|
|
|
|
) if ref $value ne 'ARRAY'; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
9
|
$self->{'global_safe'} = $context->{'ns'}->[-1]->{'_dtl_safe'}; |
22
|
4
|
|
|
|
|
6
|
$self->{'safeseq'} = $filter_manager->{'safeseq'}; |
23
|
4
|
|
|
|
|
5
|
$filter_manager->{'safe'} = 1; |
24
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
9
|
return $self->make_list($value, {}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub make_list |
29
|
|
|
|
|
|
|
{ |
30
|
6
|
|
|
6
|
0
|
7
|
my $self = shift; |
31
|
6
|
|
|
|
|
7
|
my $array = shift; |
32
|
6
|
|
|
|
|
4
|
my $recursion_control = shift; |
33
|
|
|
|
|
|
|
|
34
|
6
|
100
|
50
|
|
|
46
|
warn "Recursive data encountered, skipping" and return if exists $recursion_control->{$array}; |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
10
|
$recursion_control->{$array} = 1; |
37
|
5
|
|
|
|
|
8
|
my @values = (); |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
8
|
foreach my $element (@$array) |
40
|
|
|
|
|
|
|
{ |
41
|
20
|
|
|
|
|
21
|
my $element_type = ref $element; |
42
|
20
|
100
|
|
|
|
20
|
if( $element_type eq 'ARRAY' ) |
43
|
|
|
|
|
|
|
{ |
44
|
2
|
|
|
|
|
10
|
my $rendered = $self->make_list($element, $recursion_control); |
45
|
|
|
|
|
|
|
|
46
|
2
|
100
|
|
|
|
16
|
if( $rendered ) |
47
|
|
|
|
|
|
|
{ |
48
|
1
|
|
|
|
|
8
|
$rendered =~ s/^/\t/mg; |
49
|
1
|
|
50
|
|
|
8
|
push @values, sprintf( "\t\n", $rendered // 'undef'); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
push @values, sprintf( |
56
|
|
|
|
|
|
|
"\t%s" |
57
|
18
|
100
|
66
|
|
|
113
|
, ( not $self->{'safeseq'} and not $self->{'global_safe'} ) |
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
58
|
|
|
|
|
|
|
? DTL::Fast::html_protect($element // '') |
59
|
|
|
|
|
|
|
: $element // '' |
60
|
|
|
|
|
|
|
)."\n"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
5
|
|
|
|
|
11
|
delete $recursion_control->{$array}; |
65
|
5
|
|
|
|
|
25
|
return join '', @values; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |