line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Changeset; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
55
|
use strict; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
263
|
|
4
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
48
|
|
|
8
|
|
|
|
|
300
|
|
5
|
8
|
|
|
8
|
|
43
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
77
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.22'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
2375
|
my $self = shift; |
11
|
1607
|
|
|
|
|
3696
|
$self->{pattern} = '!?\[\d+\]|(?:\b|!)r\d+\b(?!:\d)'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub format_link { |
15
|
6
|
|
|
6
|
0
|
21
|
my ( $self, $match, $target, $label ) = @_; |
16
|
6
|
50
|
|
|
|
34
|
return $match if $self->_is_disabled; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
29
|
my $c = $self->{context}; |
19
|
6
|
|
66
|
|
|
30
|
$label ||= $match; |
20
|
6
|
|
|
|
|
29
|
my ($rev) = ( $match =~ m/(\d+)/ ); |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
66
|
|
|
128
|
my $url = $c->{trac_changeset_url} || $c->trac_url . 'changeset/'; |
23
|
6
|
|
|
|
|
52
|
$url .= $rev; |
24
|
6
|
50
|
|
|
|
80
|
return sprintf '%s', ( $c->{class} ? q{class="changeset"} : '' ), $url, $label; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |