blib/lib/Text/Trac/Table.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 3 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 93.1% 41 / 44 SCAR 13.9
CC
4
Cov
97%
parse
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/Text/Trac/LinkResolver/Ticket.pm ↑ Summary blib/lib/Text/Trac/Heading.pm »
1 package Text::Trac::Table;
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 14 ▶ my ( $self, $l ) = @_;
Subroutine parse: called CC=4 SCAR=13.9
Pod undocumented
17 14 my $c = $self->{context};
18 14 my $pattern = $self->pattern;
19 14 ▶ $l =~ $pattern or return $l;
Branch: 1 branch
BranchTrueFalseTotal
$l =~ /$pattern/msx or return $l 0 14 14
20  
21 14 $c->htmllines('<table>');
22  
23 14 $c->unshiftline;
24 14 ▶ while ( $c->hasnext and ( $c->nextline =~ $pattern ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->hasnext and $c->nextline =~ /$pattern/msx) 279 14 293
Condition100%3/3
$c->hasnext and $c->nextline =~ /$pattern/msx
!ll&&!rl&&r
59279
MC/DC100%2/2
$c->hasnext and $c->nextline =~ /$pattern/msx
$c->hasnext $c->nextline =~ /$pattern/msx
Truth table100%3/3
A and B
A= $c->hasnextB= $c->nextline =~ /$pattern/msx
ABresult
0X0
100
111
25 279 my $l = $c->shiftline;
26 279 $l =~ s{ $self->{pattern} }{$1}xmsg;
27 $l = '<tr><td>' . join(
28 '</td><td>',
29 map {
30 279 $self->replace($_) # parse inline nodes
31 } split( /\|\|/, $l )
32 ) . '</td></tr>';
33  
34 279 $c->htmllines($l);
35 }
36  
37 14 $c->htmllines('</table>');
38  
39 14 return;
40 }
41  
42 48 1;
« blib/lib/Text/Trac/LinkResolver/Ticket.pm ↑ Summary blib/lib/Text/Trac/Heading.pm »