line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::CommonMark; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
14128
|
use 5.008; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.000_002'; |
8
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
377
|
use parent qw( Template::Plugin::Filter ); |
|
1
|
|
|
|
|
226
|
|
|
1
|
|
|
|
|
6
|
|
11
|
1
|
|
|
1
|
|
5805
|
use CommonMark; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
$self->{_DYNAMIC} = 1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $name = $self->{ _ARGS }->[0] || 'cmark'; |
18
|
|
|
|
|
|
|
$self->install_filter($name); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub filter { |
24
|
|
|
|
|
|
|
my ($self, $text, $args, $config) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$config = { %{$self->{_CONFIG}}, %{$config || {}} }; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $opt = CommonMark::OPT_DEFAULT; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$config->{normalize} and $opt |= CommonMark::OPT_NORMALIZE; |
31
|
|
|
|
|
|
|
$config->{validate_utf8} and $opt |= CommonMark::OPT_VALIDATE_UTF8; |
32
|
|
|
|
|
|
|
$config->{smart} and $opt |= CommonMark::OPT_SMART; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
CommonMark->markdown_to_html($text, $opt) |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__PACKAGE__; |
38
|
|
|
|
|
|
|
__END__ |