| 1 | package Template::Mustache::Token::Template; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 23 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Object representing a Template block | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 23 | $Template::Mustache::Token::Template::VERSION = '1.3.3'; | |||||||||||||||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 23 | ▶ | use MooseX::MungeHas { has_ro => [ 'is_ro' ] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 23 | has_ro 'items'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | has escape => ( | ||||||||||||||||||||||||||||||||||||||||||
| 12 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 13 | 59 | ▶ | lazy => 1, default => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 23 | predicate => 1, | |||||||||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | sub flatten { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 165 | ▶ | return map { ref $_ eq 'ARRAY' ? flatten(@$_) : $_ } grep { ref } @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flatten: called CC=2 SCAR=7.1
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | sub render { | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 165 | ▶ | my( $self, $context, $partials, $indent ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 490 | ▶ | my @nodes = grep { ref $_ ne 'Template::Mustache::Token::Verbatim' or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 165 | length $_->content } flatten( @{ $self->items } ); | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | $_->can('has_escape') and ( $_->has_escape or $_->escape($self->escape) ) | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 165 | ▶ | for @nodes; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$_->can('has_escape') && ($_->has_escape || $_->escape($self->escape))
$_->has_escape or $_->escape($self->escape)
MC/DC0%0/3
$_->can('has_escape') && ($_->has_escape || $_->escape($self->escape))
$_->can('has_escape')
$_->has_escape
$_->escape($self->escape)
Truth table0%0/4
A && B or C
A= $_->can('has_escape')B= $_->has_escapeC= $_->escape($self->escape)
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 165 | ▶ | if( @nodes and ref $nodes[-1] eq 'Template::Mustache::Token::Verbatim' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@nodes and ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
MC/DC50%1/2
@nodes and ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
@nodes
ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
Truth table66%2/3
A and B
A= @nodesB= ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 38 | $nodes[-1]->last(1); | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 165 | return join '', map { $_->render($context, $partials, $indent ) } @nodes; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 23 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | Template::Mustache::Token::Template - Object representing a Template block | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | version 1.3.3 | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | Pieter van de Bruggen <pvande@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | Yanick Champoux <yanick@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | Ricardo Signes <rjbs@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | This software is copyright (c) 2019, 2018, 2017, 2016, 2015, 2011 by Pieter van de Bruggen. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||
| 76 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | =cut | ||||||||||||||||||||||||||||||||||||||||||