line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::ResolveLink; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4196
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
95
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw(Template::Plugin); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
962
|
|
7
|
|
|
|
|
|
|
our $FILTER_NAME = 'resolve_link'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
7432
|
use HTML::ResolveLink; |
|
2
|
|
|
|
|
29476
|
|
|
2
|
|
|
|
|
400
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1
|
|
|
1
|
1
|
31116
|
my($class, $context, @args) = @_; |
13
|
1
|
|
33
|
|
|
16
|
my $name = $args[0] || $FILTER_NAME; |
14
|
1
|
|
|
|
|
7
|
$context->define_filter($name, $class->filter_factory()); |
15
|
1
|
|
|
|
|
28
|
bless {}, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub filter_factory { |
19
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
20
|
|
|
|
|
|
|
my $sub = sub { |
21
|
1
|
|
|
1
|
|
48
|
my($context, @args) = @_; |
22
|
1
|
50
|
|
|
|
5
|
my $config = ref $args[-1] eq 'HASH' ? pop(@args) : { }; |
23
|
|
|
|
|
|
|
return sub { |
24
|
1
|
|
|
|
|
18
|
my $html = shift; |
25
|
1
|
|
|
|
|
10
|
my $resolver = HTML::ResolveLink->new(%$config); |
26
|
1
|
|
|
|
|
9082
|
return $resolver->resolve($html); |
27
|
1
|
|
|
|
|
7
|
}; |
28
|
1
|
|
|
|
|
8
|
}; |
29
|
1
|
|
|
|
|
8
|
return [ $sub, 1 ]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |