line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Clickable; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
131256
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
113
|
|
4
|
|
|
|
|
|
|
our $VERSION = 0.06; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Template::Plugin; |
7
|
2
|
|
|
2
|
|
11
|
use base qw(Template::Plugin); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1679
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
9467
|
use vars qw($FILTER_NAME); |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
123
|
|
10
|
|
|
|
|
|
|
$FILTER_NAME = 'clickable'; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
2091
|
use UNIVERSAL::require; |
|
2
|
|
|
|
|
5201
|
|
|
2
|
|
|
|
|
145
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
3
|
|
|
3
|
1
|
7756
|
my($class, $context, @args) = @_; |
16
|
3
|
|
33
|
|
|
18
|
my $name = $args[0] || $FILTER_NAME; |
17
|
3
|
|
|
|
|
12
|
$context->define_filter($name, $class->filter_factory()); |
18
|
3
|
|
|
|
|
94
|
bless { }, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub filter_factory { |
22
|
3
|
|
|
3
|
0
|
5
|
my $class = shift; |
23
|
|
|
|
|
|
|
my $sub = sub { |
24
|
4
|
|
|
4
|
|
206
|
my($context, @args) = @_; |
25
|
4
|
100
|
|
|
|
14
|
my $config = ref $args[-1] eq 'HASH' ? pop(@args) : { }; |
26
|
|
|
|
|
|
|
return sub { |
27
|
4
|
|
|
|
|
84
|
my $text = shift; |
28
|
4
|
|
50
|
|
|
24
|
my $finder_class = $config->{finder_class} || 'URI::Find'; |
29
|
4
|
50
|
|
|
|
25
|
$finder_class->require or die $UNIVERSAL::require::ERROR; |
30
|
|
|
|
|
|
|
my $finder = $finder_class->new( |
31
|
|
|
|
|
|
|
sub { |
32
|
5
|
|
|
|
|
39057
|
my($uri, $orig_uri) = @_; |
33
|
5
|
100
|
|
|
|
22
|
my $target = $config->{target} ? qq( target="$config->{target}") : ''; |
34
|
5
|
100
|
|
|
|
16
|
my $rel = $config->{rel} ? qq( rel="$config->{rel}") : ''; |
35
|
5
|
|
|
|
|
20
|
return qq($orig_uri); |
36
|
|
|
|
|
|
|
}, |
37
|
4
|
|
|
|
|
14610
|
); |
38
|
4
|
|
|
|
|
67
|
$finder->find(\$text); |
39
|
4
|
|
|
|
|
209
|
return $text; |
40
|
4
|
|
|
|
|
25
|
}; |
41
|
3
|
|
|
|
|
19
|
}; |
42
|
3
|
|
|
|
|
22
|
return [ $sub, 1 ]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |