line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Source; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
53
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
244
|
|
4
|
8
|
|
|
8
|
|
42
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
215
|
|
5
|
8
|
|
|
8
|
|
39
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
43
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
3024
|
my $self = shift; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub format_link { |
14
|
7
|
|
|
7
|
0
|
21
|
my ( $self, $match, $target, $label ) = @_; |
15
|
7
|
50
|
|
|
|
36
|
return $match if $self->_is_disabled; |
16
|
|
|
|
|
|
|
|
17
|
7
|
|
|
|
|
33
|
my $c = $self->{context}; |
18
|
7
|
|
33
|
|
|
23
|
$label ||= $match; |
19
|
7
|
|
|
|
|
42
|
my ( $file, $rev ) = ( $target =~ m/([^#]+)(?:#(\d+))?/ ); |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
66
|
|
|
183
|
my $url = $c->{trac_source_url} || $c->trac_url . 'browser/'; |
22
|
7
|
|
|
|
|
63
|
$url .= $file; |
23
|
7
|
100
|
|
|
|
24
|
$url .= "?rev=$rev" if $rev; |
24
|
|
|
|
|
|
|
|
25
|
7
|
50
|
|
|
|
85
|
return sprintf '%s', ( $c->{class} ? q{class="source"} : '' ), $url, $label; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |