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