| 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
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 454 | my $c = $self->{context}; | |||||||||||||||||||
| 20 | 454 | ▶ | $label ||= $match; | ||||||||||||||||||
|
Condition66%2/3
$label ||= $match
MC/DC0%0/2
$label ||= $match
$label
$match
Truth table66%2/3
A ||= B
A= $labelB= $match
| |||||||||||||||||||||
| 21 | 454 | ▶ | $target ||= $match; | ||||||||||||||||||
|
Condition66%2/3
$target ||= $match
MC/DC0%0/2
$target ||= $match
$target
$match
Truth table66%2/3
A ||= B
A= $targetB= $match
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 454 | ▶ | if ( $label =~ /\[wiki:(\S+)\s+(.+)\]/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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/'
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'}
| |||||||||||||||||||||
| 29 | 454 | $url .= $target; | |||||||||||||||||||
| 30 | 454 | ▶ | return sprintf '<a %s href="%s">%s</a>', ( $c->{class} ? q{class="wiki"} : '' ), $url, $label; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 48 | 1; | |||||||||||||||||||