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