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