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