| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Text::Trac::LinkResolver::Comment; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 8 |  |  | 8 |  | 58 | use strict; | 
|  | 8 |  |  |  |  | 16 |  | 
|  | 8 |  |  |  |  | 225 |  | 
| 4 | 8 |  |  | 8 |  | 41 | use warnings; | 
|  | 8 |  |  |  |  | 17 |  | 
|  | 8 |  |  |  |  | 214 |  | 
| 5 | 8 |  |  | 8 |  | 42 | use base qw( Text::Trac::LinkResolver ); | 
|  | 8 |  |  |  |  | 14 |  | 
|  | 8 |  |  |  |  | 40 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.23'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | sub init { | 
| 10 | 1607 |  |  | 1607 | 0 | 2396 | my $self = shift; | 
| 11 | 1607 |  |  |  |  | 3382 | $self->{pattern} = '!?(? | 
| 12 |  |  |  |  |  |  | } | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub format_link { | 
| 15 | 1 |  |  | 1 | 0 | 5 | my ( $self, $match, $target, $label ) = @_; | 
| 16 | 1 | 50 |  |  |  | 12 | return $match if $self->_is_disabled; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 1 |  |  |  |  | 8 | my $c = $self->{context}; | 
| 19 | 1 |  | 33 |  |  | 8 | $label ||= $match; | 
| 20 | 1 |  |  |  |  | 8 | my ( $rev, $commentId ) = ( $match =~ m/(\d+):(\d+)/ ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 1 |  | 33 |  |  | 30 | my $url = $c->{trac_ticket_url} || $c->trac_url . 'ticket/'; | 
| 23 | 1 |  |  |  |  | 11 | $url .= $rev; | 
| 24 | 1 |  |  |  |  | 3 | $url .= "#comment:$commentId"; | 
| 25 | 1 | 50 |  |  |  | 16 | return sprintf '%s', ( $c->{class} ? q{class="ticket"} : '' ), $url, $label; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | 1; |