blib/lib/Text/Trac/Dl.pm

filter: Statementstmt 100% 45 / 45 Branchbran 78.5% 11 / 14 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 87.3% 62 / 71 SCAR 22.0
CC
9
Cov
92%
parse
9.1
BEGIN
1.0
BEGIN
1.0
CRAP 9.0
« blib/lib/Text/Trac/Ul.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Wiki.pm »
1 package Text::Trac::Dl;
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/^\s+(.*)::$/xms);
12 }
13  
14 sub parse {
15 3 ▶ my ( $self, $l ) = @_;
Subroutine parse: called CC=9 SCAR=22.1
Pod undocumented
16 3 my $c = $self->{context};
17 3 my $pattern = $self->pattern;
18  
19 3 ▶ if ( !@{ $c->in_block_of } or $c->in_block_of->[-1] ne 'dl' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @{$c->in_block_of;} or $c->in_block_of->[-1] ne "dl") 3 0 3
Condition33%1/3
not @{$c->in_block_of;} or $c->in_block_of->[-1] ne "dl"
l!l&&r!l&&!r
300
MC/DC0%0/2
not @{$c->in_block_of;} or $c->in_block_of->[-1] ne "dl"
not @{$c->in_block_of;} $c->in_block_of->[-1] ne "dl"
Truth table33%1/3
not(A) or B
A= not @{$c->in_block_of;}B= $c->in_block_of->[-1] ne "dl"
ABresult
1X1
011
000
20 3 $c->htmllines('<dl>');
21 3 push @{ $c->in_block_of }, 'dl';
22 }
23  
24 3 $c->unshiftline;
25 3 ▶ while ( $c->hasnext ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->hasnext) 19 3 22
26 19 ▶ last if ( $c->nextline =~ /^$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $c->nextline =~ /^$/ 0 19 19
27 19 my $l = $c->shiftline;
28  
29 19 ▶ if ( $l =~ /$pattern/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($l =~ /$pattern/msx) { } 6 13 19
30 6 ▶ if ( $c->in_block_of->[-1] eq 'dd' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->in_block_of->[-1] eq 'dd') { } 3 3 6
31 3 $l = "</dd>\n<dt>$1</dt>";
32 3 pop @{ $c->in_block_of };
33 }
34 else {
35 3 $l = "<dt>$1</dt>";
36 }
37 }
38 else {
39 13 $l =~ s/^\s+//g;
40 13 ▶ if ( $c->in_block_of->[-1] ne 'dd' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->in_block_of->[-1] ne "dd") 6 7 13
41 6 $l = "<dd>\n$l";
42 6 push @{ $c->in_block_of }, 'dd';
43 }
44 }
45 19 $c->htmllines($l);
46 }
47  
48 3 ▶ if ( $c->in_block_of->[-1] eq 'dd' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->in_block_of->[-1] eq "dd") 3 0 3
49 3 $c->htmllines('</dd>');
50 3 pop @{ $c->in_block_of };
51 }
52  
53 3 pop @{ $c->in_block_of };
54 3 $c->htmllines('</dl>');
55  
56 3 return;
57 }
58  
59 48 1;
« blib/lib/Text/Trac/Ul.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Wiki.pm »