line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::MultiMarkdown; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
206774
|
use warnings; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
211
|
|
4
|
6
|
|
|
6
|
|
605
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
327
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.10"; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
32
|
use vars qw($text_mmd_class); |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
324
|
|
9
|
6
|
|
|
6
|
|
6540
|
use parent qw (Template::Plugin::Filter); |
|
6
|
|
|
|
|
2321
|
|
|
6
|
|
|
|
|
35
|
|
10
|
6
|
|
|
6
|
|
51895
|
use Carp; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
740
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
6
|
|
|
6
|
|
16
|
$text_mmd_class = 'Text::MultiMarkdown::XS'; |
14
|
6
|
|
|
|
|
461
|
eval 'require Text::MultiMarkdown::XS'; |
15
|
6
|
50
|
|
|
|
51
|
if ($@) { |
16
|
6
|
|
|
|
|
13
|
$text_mmd_class = 'Text::MultiMarkdown'; |
17
|
6
|
|
|
|
|
443
|
eval 'require Text::MultiMarkdown'; |
18
|
6
|
50
|
|
|
|
450300
|
if ($@) { |
19
|
0
|
|
|
|
|
0
|
croak "cannot load either Text::MultiMarkdown::XS or Text::MultiMarkdown"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init { |
25
|
5
|
|
|
5
|
1
|
34822
|
my $self = shift; |
26
|
5
|
|
|
|
|
23
|
$self->{_DYNAMIC} = 1; |
27
|
5
|
|
50
|
|
|
60
|
$self->install_filter($self->{_ARGS}->[0] || 'multimarkdown'); |
28
|
5
|
|
|
|
|
202
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub filter { |
32
|
5
|
|
|
5
|
1
|
353
|
my ($self, $text, $args, $config) = @_; |
33
|
|
|
|
|
|
|
|
34
|
5
|
50
|
|
|
|
9
|
my $options = { %{$self->{_CONFIG}}, %{$config || {}} }; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
23
|
|
35
|
5
|
|
100
|
|
|
21
|
my $req_class = delete $options->{implementation} || ''; |
36
|
|
|
|
|
|
|
|
37
|
5
|
100
|
|
|
|
16
|
if ($req_class eq 'PP') { |
|
|
50
|
|
|
|
|
|
38
|
4
|
|
|
|
|
30
|
require Text::MultiMarkdown; |
39
|
4
|
|
|
|
|
28
|
return Text::MultiMarkdown->new(%$options)->markdown($text); |
40
|
|
|
|
|
|
|
} elsif ($req_class eq 'XS') { |
41
|
0
|
|
|
|
|
0
|
require Text::MultiMarkdown::XS; |
42
|
0
|
|
|
|
|
0
|
return Text::MultiMarkdown::XS->new($options)->markdown($text); |
43
|
|
|
|
|
|
|
} else { |
44
|
1
|
|
|
|
|
6
|
return $text_mmd_class->new(%$options)->markdown($text); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |