line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Unorderedlist; |
2
|
2
|
|
|
2
|
|
1261
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
2
|
|
48
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
48
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
3
|
2
|
|
|
2
|
|
10
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
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
|
|
|
10
|
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
|
|
|
|
|
8
|
$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
|
10
|
my $self = shift; |
31
|
6
|
|
|
|
|
8
|
my $array = shift; |
32
|
6
|
|
|
|
|
7
|
my $recursion_control = shift; |
33
|
|
|
|
|
|
|
|
34
|
6
|
100
|
50
|
|
|
37
|
warn "Recursive data encountered, skipping" and return if exists $recursion_control->{$array}; |
35
|
|
|
|
|
|
|
|
36
|
5
|
|
|
|
|
12
|
$recursion_control->{$array} = 1; |
37
|
5
|
|
|
|
|
8
|
my @values = (); |
38
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
9
|
foreach my $element (@$array) |
40
|
|
|
|
|
|
|
{ |
41
|
20
|
|
|
|
|
28
|
my $element_type = ref $element; |
42
|
20
|
100
|
|
|
|
31
|
if( $element_type eq 'ARRAY' ) |
43
|
|
|
|
|
|
|
{ |
44
|
2
|
|
|
|
|
7
|
my $rendered = $self->make_list($element, $recursion_control); |
45
|
|
|
|
|
|
|
|
46
|
2
|
100
|
|
|
|
13
|
if( $rendered ) |
47
|
|
|
|
|
|
|
{ |
48
|
1
|
|
|
|
|
6
|
$rendered =~ s/^/\t/mg; |
49
|
1
|
|
50
|
|
|
6
|
push @values, sprintf( "\t\n", $rendered // 'undef'); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
push @values, sprintf( |
56
|
|
|
|
|
|
|
"\t%s" |
57
|
18
|
100
|
66
|
|
|
119
|
, ( 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
|
|
|
|
|
13
|
delete $recursion_control->{$array}; |
65
|
5
|
|
|
|
|
28
|
return join '', @values; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |