File Coverage

blib/lib/Text/Trac/LinkResolver/Milestone.pm
Criterion Covered Total %
statement 18 18 100.0
branch 3 4 75.0
condition 3 6 50.0
subroutine 5 5 100.0
pod 0 2 0.0
total 29 35 82.8


line stmt bran cond sub pod time code
1             package Text::Trac::LinkResolver::Milestone;
2              
3 8     8   57 use strict;
  8         20  
  8         235  
4 8     8   39 use warnings;
  8         15  
  8         220  
5 8     8   45 use base qw( Text::Trac::LinkResolver );
  8         15  
  8         41  
6              
7             our $VERSION = '0.23';
8              
9             sub init {
10 1607     1607 0 3082 my $self = shift;
11             }
12              
13             sub format_link {
14 6     6 0 24 my ( $self, $match, $target, $label ) = @_;
15 6 100       42 return $match if $self->_is_disabled;
16              
17 5         25 my $c = $self->{context};
18 5   33     16 $label ||= $match;
19 5         20 my ( $from, $to ) = ( $match =~ m/(\d+):(\d+)/ );
20              
21 5   66     114 my $url = $c->{trac_milestone_url} || $c->trac_url . 'milestone/';
22 5         35 $url .= $target;
23              
24 5 50       85 return sprintf '%s', ( $c->{class} ? q{class="milestone"} : '' ), $url, $label;
25             }
26              
27             1;