| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Text::Trac::LinkResolver::Wiki; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 8 |  |  | 8 |  | 45 | use strict; | 
|  | 8 |  |  |  |  | 12 |  | 
|  | 8 |  |  |  |  | 194 |  | 
| 4 | 8 |  |  | 8 |  | 31 | use warnings; | 
|  | 8 |  |  |  |  | 12 |  | 
|  | 8 |  |  |  |  | 199 |  | 
| 5 | 8 |  |  | 8 |  | 44 | use base qw( Text::Trac::LinkResolver ); | 
|  | 8 |  |  |  |  | 13 |  | 
|  | 8 |  |  |  |  | 41 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.24'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | sub init { | 
| 10 | 1607 |  |  | 1607 | 0 | 2001 | my $self = shift; | 
| 11 |  |  |  |  |  |  | $self->{pattern} | 
| 12 | 1607 |  |  |  |  | 3083 | = '!?(? | 
| 13 |  |  |  |  |  |  | } | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub format_link { | 
| 16 | 5 |  |  | 5 | 0 | 16 | my ( $self, $match, $target, $label ) = @_; | 
| 17 | 5 | 50 |  |  |  | 28 | return $match if $self->_is_disabled; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 5 |  |  |  |  | 22 | my $c = $self->{context}; | 
| 20 | 5 |  | 66 |  |  | 25 | $label  ||= $match; | 
| 21 | 5 |  | 66 |  |  | 21 | $target ||= $match; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 5 | 100 |  |  |  | 19 | if ( $label =~ /\[wiki:(\S+)\s+(.+)\]/ ) { | 
| 24 | 1 |  |  |  |  | 3 | $target = $1; | 
| 25 | 1 |  |  |  |  | 3 | $label  = $2; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 5 |  | 66 |  |  | 90 | my $url = $c->{trac_wiki_url} || $c->trac_url . 'wiki/'; | 
| 29 | 5 |  |  |  |  | 33 | $url .= $target; | 
| 30 | 5 | 50 |  |  |  | 53 | return sprintf '%s', ( $c->{class} ? q{class="wiki"} : '' ), $url, $label; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | 1; |