line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Trac::LinkResolver::Attachment; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
47
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
188
|
|
4
|
8
|
|
|
8
|
|
32
|
use warnings; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
176
|
|
5
|
8
|
|
|
8
|
|
32
|
use base qw( Text::Trac::LinkResolver ); |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.24'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub init { |
10
|
1607
|
|
|
1607
|
0
|
2791
|
my $self = shift; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub format_link { |
14
|
5
|
|
|
5
|
0
|
13
|
my ( $self, $match, $target, $label ) = @_; |
15
|
5
|
50
|
|
|
|
28
|
return $match if $self->_is_disabled; |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
24
|
my $c = $self->{context}; |
18
|
5
|
|
33
|
|
|
14
|
$label ||= $match; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
32
|
my ( $type, $name, $file ) = ( $match =~ m/attachment:([^:]+):([^:]+):([^:\]\s]+)/ ); |
21
|
5
|
|
66
|
|
|
89
|
my $url = $c->{trac_attachment_url} || $c->trac_url . 'attachment/'; |
22
|
5
|
|
|
|
|
39
|
$url .= "$type/$name/$file"; |
23
|
|
|
|
|
|
|
|
24
|
5
|
50
|
|
|
|
53
|
return sprintf '%s', ( $c->{class} ? q{class="attachment"} : '' ), $url, $label; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |