line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Hatena; |
2
|
2
|
|
|
2
|
|
97265
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
80
|
|
3
|
2
|
|
|
2
|
|
12
|
use base qw (Template::Plugin::Filter); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1952
|
|
4
|
2
|
|
|
2
|
|
13379
|
use Text::Hatena; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.02; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub init { |
9
|
|
|
|
|
|
|
my $self = shift; |
10
|
|
|
|
|
|
|
$self->{_DYNAMIC} = 1; |
11
|
|
|
|
|
|
|
$self->install_filter($self->{_ARGS}->[0] || 'hatena'); |
12
|
|
|
|
|
|
|
$self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub filter { |
16
|
|
|
|
|
|
|
my ($self, $text, $args, $config) = @_; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if (Text::Hatena->VERSION >= 0.20) { |
19
|
|
|
|
|
|
|
Text::Hatena->parse($text) |
20
|
|
|
|
|
|
|
} else { |
21
|
|
|
|
|
|
|
my $parser = Text::Hatena->new(%$config); |
22
|
|
|
|
|
|
|
$parser->parse($text); |
23
|
|
|
|
|
|
|
return $parser->html; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |