line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::MultiMarkdown; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
100821
|
use warnings; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
151
|
|
4
|
6
|
|
|
6
|
|
16
|
use strict; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
188
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.12"; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
22
|
use vars qw($text_mmd_class); |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
225
|
|
9
|
6
|
|
|
6
|
|
2051
|
use parent qw (Template::Plugin::Filter); |
|
6
|
|
|
|
|
1231
|
|
|
6
|
|
|
|
|
23
|
|
10
|
6
|
|
|
6
|
|
24435
|
use Carp; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
420
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
6
|
|
|
6
|
|
8
|
$text_mmd_class = 'Text::MultiMarkdown::XS'; |
14
|
6
|
|
|
|
|
256
|
eval 'require Text::MultiMarkdown::XS'; |
15
|
6
|
50
|
|
|
|
26
|
if ($@) { |
16
|
6
|
|
|
|
|
7
|
$text_mmd_class = 'Text::MultiMarkdown'; |
17
|
6
|
|
|
|
|
221
|
eval 'require Text::MultiMarkdown'; |
18
|
6
|
50
|
|
|
|
203238
|
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
|
18471
|
my $self = shift; |
26
|
5
|
|
|
|
|
13
|
$self->{_DYNAMIC} = 1; |
27
|
5
|
|
50
|
|
|
320
|
$self->install_filter($self->{_ARGS}->[0] || 'multimarkdown'); |
28
|
5
|
|
|
|
|
121
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub filter { |
32
|
5
|
|
|
5
|
1
|
230
|
my ($self, $text, $args, $config) = @_; |
33
|
|
|
|
|
|
|
|
34
|
5
|
50
|
|
|
|
4
|
my $options = { %{$self->{_CONFIG}}, %{$config || {}} }; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
14
|
|
35
|
5
|
|
100
|
|
|
16
|
my $req_class = delete $options->{implementation} || ''; |
36
|
|
|
|
|
|
|
|
37
|
5
|
100
|
|
|
|
7
|
if ($req_class eq 'PP') { |
|
|
50
|
|
|
|
|
|
38
|
4
|
|
|
|
|
18
|
require Text::MultiMarkdown; |
39
|
4
|
|
|
|
|
15
|
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
|
|
|
|
|
51
|
return $text_mmd_class->new(%$options)->markdown($text); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |