line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Ticket; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
54
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
225
|
|
4
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
207
|
|
5
|
8
|
|
|
8
|
|
54
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
40
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.22'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
2270
|
my $self = shift; |
11
|
1607
|
|
|
|
|
3428
|
$self->{pattern} = '!?(?
|
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub format_link { |
15
|
7
|
|
|
7
|
0
|
25
|
my ( $self, $match, $target, $label ) = @_; |
16
|
7
|
100
|
|
|
|
50
|
return $match if $self->_is_disabled; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
31
|
my $c = $self->{context}; |
19
|
6
|
|
66
|
|
|
27
|
$label ||= $match; |
20
|
6
|
|
|
|
|
29
|
my ($rev) = ( $match =~ m/(\d+)/ ); |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
66
|
|
|
146
|
my $url = $c->{trac_ticket_url} || $c->trac_url . 'ticket/'; |
23
|
6
|
|
|
|
|
51
|
$url .= $rev; |
24
|
6
|
50
|
|
|
|
78
|
return sprintf '%s', ( $c->{class} ? q{class="ticket"} : '' ), $url, $label; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |