blib/lib/Text/Trac/Pre.pm

filter: Statementstmt 100% 29 / 29 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 89.1% 41 / 46 SCAR 17.9
CC
6
Cov
92%
parse
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 6.0
« blib/lib/Text/Trac/Node.pm ↑ Summary blib/lib/Text/Trac/Macro.pm »
1 package Text::Trac::Pre;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 48 ▶use base qw(Text::Trac::BlockNode);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 48 our $VERSION = '0.23';
8  
9 sub init {
10 160 ▶ my $self = shift;
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
11 160 $self->pattern(qr/^\{\{\{$/xms);
12 160 return $self;
13 }
14  
15 sub parse {
16 44 ▶ my ( $self, $l ) = @_;
Subroutine parse: called CC=6 SCAR=18.0
Pod undocumented
17 44 my $c = $self->{context};
18 44 my $pattern = $self->pattern;
19 44 ▶ $l =~ /$pattern/ or return $l;
Branch: 1 branch
BranchTrueFalseTotal
$l =~ /$pattern/msx or return $l 0 44 44
20 44 my $match = $1;
21 44 ▶ my $class = $c->{class} ? q{ class="wiki"} : '';
Branch: 1 branch
BranchTrueFalseTotal
$c->{'class'} ? : 13 31 44
22  
23 44 ▶ if ( $l =~ /^\{\{\{$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($l =~ /^\{\{\{$/) 44 0 44
24 44 $c->htmllines(qq{<pre$class>});
25 }
26  
27 44 ▶ while ( $c->hasnext ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->hasnext) 221 0 221
28 221 my $l = $c->shiftline;
29 221 ▶ if ( $l =~ /^\}\}\}$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($l =~ /^\}\}\}$/) { } 44 177 221
30 44 $c->htmllines('</pre>');
31 44 last;
32 }
33 else {
34 177 $c->htmllines( $self->escape($l) );
35 }
36 }
37  
38 44 return;
39 }
40  
41 48 1;
« blib/lib/Text/Trac/Node.pm ↑ Summary blib/lib/Text/Trac/Macro.pm »