line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Wiki; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
55
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
240
|
|
4
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
244
|
|
5
|
8
|
|
|
8
|
|
57
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
73
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
2464
|
my $self = shift; |
11
|
|
|
|
|
|
|
$self->{pattern} |
12
|
1607
|
|
|
|
|
4048
|
= '!?(?
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub format_link { |
16
|
5
|
|
|
5
|
0
|
18
|
my ( $self, $match, $target, $label ) = @_; |
17
|
5
|
50
|
|
|
|
34
|
return $match if $self->_is_disabled; |
18
|
|
|
|
|
|
|
|
19
|
5
|
|
|
|
|
25
|
my $c = $self->{context}; |
20
|
5
|
|
66
|
|
|
31
|
$label ||= $match; |
21
|
5
|
|
66
|
|
|
28
|
$target ||= $match; |
22
|
|
|
|
|
|
|
|
23
|
5
|
100
|
|
|
|
26
|
if ( $label =~ /\[wiki:(\S+)\s+(.+)\]/ ) { |
24
|
1
|
|
|
|
|
5
|
$target = $1; |
25
|
1
|
|
|
|
|
5
|
$label = $2; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
5
|
|
66
|
|
|
105
|
my $url = $c->{trac_wiki_url} || $c->trac_url . 'wiki/'; |
29
|
5
|
|
|
|
|
39
|
$url .= $target; |
30
|
5
|
50
|
|
|
|
63
|
return sprintf '%s', ( $c->{class} ? q{class="wiki"} : '' ), $url, $label; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |