line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::markdown_to_html; |
2
|
1
|
|
|
1
|
|
18326
|
use Catmandu::Sane; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Moo; |
4
|
|
|
|
|
|
|
use Catmandu::Util qw(:is :check); |
5
|
|
|
|
|
|
|
use Text::Markdown::Discount; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.011"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has field => ( |
10
|
|
|
|
|
|
|
is => 'ro' , |
11
|
|
|
|
|
|
|
required => 1 |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
around BUILDARGS => sub { |
14
|
|
|
|
|
|
|
my($orig,$class,$field) = @_; |
15
|
|
|
|
|
|
|
$orig->($class,field => $field); |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub emit { |
19
|
|
|
|
|
|
|
my($self,$fixer) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $perl = ""; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $field = $fixer->split_path($self->field()); |
24
|
|
|
|
|
|
|
my $key = pop @$field; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$perl .= $fixer->emit_walk_path($fixer->var,$field,sub{ |
27
|
|
|
|
|
|
|
my $var = shift; |
28
|
|
|
|
|
|
|
$fixer->emit_get_key($var,$key, sub { |
29
|
|
|
|
|
|
|
my $var = shift; |
30
|
|
|
|
|
|
|
"${var} = is_string(${var}) ? Text::Markdown::Discount::markdown(${var}) : \"\";"; |
31
|
|
|
|
|
|
|
}); |
32
|
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$perl; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Catmandu::Fix::markdown_to_html - converts markdown to html elements |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
markdown_to_html('text_markdown') |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SEE ALSO |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
L |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |