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