line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Mustache::Token::Section; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Object representing a Section block |
4
|
|
|
|
|
|
|
$Template::Mustache::Token::Section::VERSION = '1.3.3'; |
5
|
20
|
|
|
20
|
|
130
|
use Moo; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
112
|
|
6
|
|
|
|
|
|
|
|
7
|
20
|
|
|
20
|
|
8077
|
use MooseX::MungeHas { has_ro => [ 'is_ro' ] }; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
171
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has_ro 'variable'; |
10
|
|
|
|
|
|
|
has_ro 'template'; |
11
|
|
|
|
|
|
|
has_ro 'inverse'; |
12
|
|
|
|
|
|
|
has_ro 'delimiters'; |
13
|
|
|
|
|
|
|
has_ro 'raw'; |
14
|
|
|
|
|
|
|
|
15
|
20
|
|
|
20
|
|
17484
|
use Template::Mustache; |
|
20
|
|
|
|
|
48
|
|
|
20
|
|
|
|
|
5249
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub render { |
18
|
11
|
|
|
11
|
0
|
32
|
my( $self, $context, $partials, $indent ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
58
|
my $cond = Template::Mustache::resolve_context( $self->variable, $context ); |
21
|
|
|
|
|
|
|
|
22
|
11
|
100
|
|
|
|
38
|
if ( ref $cond eq 'CODE' ) { |
23
|
|
|
|
|
|
|
my $value=Template::Mustache->new( |
24
|
|
|
|
|
|
|
delimiters => $self->delimiters, |
25
|
|
|
|
|
|
|
template => $cond->( |
26
|
|
|
|
|
|
|
$self->raw, |
27
|
|
|
|
|
|
|
sub { |
28
|
2
|
|
|
2
|
|
55
|
Template::Mustache->new( template=> shift )->parsed->render( |
29
|
|
|
|
|
|
|
$context, $partials, $indent |
30
|
|
|
|
|
|
|
) } |
31
|
|
|
|
|
|
|
) |
32
|
2
|
|
|
|
|
18
|
)->parsed->render( $context, $partials ); |
33
|
|
|
|
|
|
|
|
34
|
2
|
50
|
|
|
|
12
|
return '' if $self->inverse; |
35
|
2
|
|
|
|
|
278
|
return $value; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
9
|
50
|
|
|
|
40
|
if ( $self->inverse ) { |
39
|
0
|
0
|
|
|
|
0
|
if ( ref $cond eq 'ARRAY' ) { |
40
|
0
|
|
|
|
|
0
|
$cond = ! @$cond; |
41
|
|
|
|
|
|
|
}else { |
42
|
0
|
|
|
|
|
0
|
$cond = !$cond; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
9
|
50
|
|
|
|
27
|
return unless $cond; |
47
|
|
|
|
|
|
|
|
48
|
9
|
50
|
|
|
|
39
|
return join '', map { $self->template->render( [ $_, @$context ], $partials ) } |
|
9
|
|
|
|
|
55
|
|
49
|
|
|
|
|
|
|
ref $cond eq 'ARRAY' ? @$cond : ( $cond ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Template::Mustache::Token::Section - Object representing a Section block |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 1.3.3 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHORS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Pieter van de Bruggen <pvande@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Ricardo Signes <rjbs@cpan.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is copyright (c) 2019, 2018, 2017, 2016, 2015, 2011 by Pieter van de Bruggen. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
91
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |