line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Changeset; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
59
|
use strict; |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
249
|
|
4
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
294
|
|
5
|
8
|
|
|
8
|
|
44
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
47
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.23'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
2487
|
my $self = shift; |
11
|
1607
|
|
|
|
|
3784
|
$self->{pattern} = '!?\[\d+\]|(?:\b|!)r\d+\b(?!:\d)'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub format_link { |
15
|
6
|
|
|
6
|
0
|
19
|
my ( $self, $match, $target, $label ) = @_; |
16
|
6
|
50
|
|
|
|
35
|
return $match if $self->_is_disabled; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
33
|
my $c = $self->{context}; |
19
|
6
|
|
66
|
|
|
27
|
$label ||= $match; |
20
|
6
|
|
|
|
|
28
|
my ($rev) = ( $match =~ m/(\d+)/ ); |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
66
|
|
|
129
|
my $url = $c->{trac_changeset_url} || $c->trac_url . 'changeset/'; |
23
|
6
|
|
|
|
|
49
|
$url .= $rev; |
24
|
6
|
50
|
|
|
|
79
|
return sprintf '%s', ( $c->{class} ? q{class="changeset"} : '' ), $url, $label; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |