blib/lib/Text/Trac/LinkResolver/Wiki.pm

filter: Statementstmt 100% 24 / 24 Branchbran 83.3% 5 / 6 Conditioncond 75.0% 6 / 8 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 82.0% 41 / 50 SCAR 19.5
CC
7
Cov
92%
format_link
7.1
BEGIN
1.0
BEGIN
1.0
CRAP 7.0
« blib/lib/Text/Trac/Dl.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Source.pm »
1 package Text::Trac::LinkResolver::Wiki;
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::LinkResolver );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 48 our $VERSION = '0.23';
8  
9 sub init {
10 5462 ▶ my $self = shift;
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
11 $self->{pattern}
12 5462 = '!?(?<!/)\b[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+' . '(?:\#[A-Za-z_:][A-Za-z0-9_:.-]*)?(?=\Z|[\s.,;:!?\)\}\]])';
13 }
14  
15 sub format_link {
16 454 ▶ my ( $self, $match, $target, $label ) = @_;
Subroutine format_link: called CC=7 SCAR=19.6
Pod undocumented
17 454 ▶ return $match if $self->_is_disabled;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_disabled 0 454 454
18  
19 454 my $c = $self->{context};
20 454 ▶ $label ||= $match;
Condition66%2/3
$label ||= $match
l!l&&r!l&&!r
413410
MC/DC0%0/2
$label ||= $match
$label $match
Truth table66%2/3
A ||= B
A= $labelB= $match
ABresult
1X1
011
000
21 454 ▶ $target ||= $match;
Condition66%2/3
$target ||= $match
l!l&&r!l&&!r
413410
MC/DC0%0/2
$target ||= $match
$target $match
Truth table66%2/3
A ||= B
A= $targetB= $match
ABresult
1X1
011
000
22  
23 454 ▶ if ( $label =~ /\[wiki:(\S+)\s+(.+)\]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($label =~ /\[wiki:(\S+)\s+(.+)\]/) 11 443 454
24 11 $target = $1;
25 11 $label = $2;
26 }
27  
28 454 ▶ my $url = $c->{trac_wiki_url} || $c->trac_url . 'wiki/';
Condition100%2/2
$c->{'trac_wiki_url'} || $c->trac_url . 'wiki/'
l!l
1453
MC/DC100%1/1
$c->{'trac_wiki_url'} || $c->trac_url . 'wiki/'
$c->{'trac_wiki_url'}
Truth table100%2/2
A
A= $c->{'trac_wiki_url'}
Aresult
11
00
29 454 $url .= $target;
30 454 ▶ return sprintf '<a %s href="%s">%s</a>', ( $c->{class} ? q{class="wiki"} : '' ), $url, $label;
Branch: 1 branch
BranchTrueFalseTotal
$c->{'class'} ? : 108 346 454
31 }
32  
33 48 1;
« blib/lib/Text/Trac/Dl.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Source.pm »