| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Perl Markdown Compiler |
|
2
|
|
|
|
|
|
|
package Markdown::Compiler; |
|
3
|
18
|
|
|
18
|
|
8290
|
use Moo; |
|
|
18
|
|
|
|
|
143875
|
|
|
|
18
|
|
|
|
|
80
|
|
|
4
|
18
|
|
|
18
|
|
29281
|
use Markdown::Compiler::Source; |
|
|
18
|
|
|
|
|
55
|
|
|
|
18
|
|
|
|
|
567
|
|
|
5
|
18
|
|
|
18
|
|
9032
|
use Markdown::Compiler::Lexer; |
|
|
18
|
|
|
|
|
47
|
|
|
|
18
|
|
|
|
|
548
|
|
|
6
|
18
|
|
|
18
|
|
9883
|
use Markdown::Compiler::Parser; |
|
|
18
|
|
|
|
|
66
|
|
|
|
18
|
|
|
|
|
560
|
|
|
7
|
18
|
|
|
18
|
|
8299
|
use Markdown::Compiler::Target::HTML; |
|
|
18
|
|
|
|
|
48
|
|
|
|
18
|
|
|
|
|
644
|
|
|
8
|
18
|
|
|
18
|
|
164
|
use Module::Runtime qw( use_module ); |
|
|
18
|
|
|
|
|
38
|
|
|
|
18
|
|
|
|
|
139
|
|
|
9
|
18
|
|
|
18
|
|
8587
|
use YAML::XS; |
|
|
18
|
|
|
|
|
44983
|
|
|
|
18
|
|
|
|
|
7670
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has source => ( |
|
12
|
|
|
|
|
|
|
is => 'ro', |
|
13
|
|
|
|
|
|
|
required => 1, |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has _source => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
lazy => 1, |
|
19
|
|
|
|
|
|
|
builder => sub { |
|
20
|
67
|
|
|
67
|
|
1297
|
Markdown::Compiler::Source->new( source => shift->source ); |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has lexer => ( |
|
25
|
|
|
|
|
|
|
is => 'ro', |
|
26
|
|
|
|
|
|
|
lazy => 1, |
|
27
|
|
|
|
|
|
|
builder => sub { |
|
28
|
65
|
|
|
65
|
|
1318
|
Markdown::Compiler::Lexer->new( source => shift->_source->body ); |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has parser => ( |
|
33
|
|
|
|
|
|
|
is => 'ro', |
|
34
|
|
|
|
|
|
|
lazy => 1, |
|
35
|
|
|
|
|
|
|
builder => sub { |
|
36
|
64
|
|
|
64
|
|
1686
|
Markdown::Compiler::Parser->new( stream => shift->stream ); |
|
37
|
|
|
|
|
|
|
}, |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has stream => ( |
|
41
|
|
|
|
|
|
|
is => 'ro', |
|
42
|
|
|
|
|
|
|
lazy => 1, |
|
43
|
|
|
|
|
|
|
builder => sub { |
|
44
|
64
|
|
|
64
|
|
1170
|
shift->lexer->tokens; |
|
45
|
|
|
|
|
|
|
}, |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has tree => ( |
|
49
|
|
|
|
|
|
|
is => 'ro', |
|
50
|
|
|
|
|
|
|
lazy => 1, |
|
51
|
|
|
|
|
|
|
builder => sub { |
|
52
|
64
|
|
|
64
|
|
1200
|
shift->parser->tree; |
|
53
|
|
|
|
|
|
|
}, |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has compiler => ( |
|
57
|
|
|
|
|
|
|
is => 'ro', |
|
58
|
|
|
|
|
|
|
lazy => 1, |
|
59
|
|
|
|
|
|
|
builder => sub { |
|
60
|
64
|
|
|
64
|
|
1197
|
Markdown::Compiler::Target::HTML->new( tree => shift->tree ); |
|
61
|
|
|
|
|
|
|
}, |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub compiler_for { |
|
65
|
0
|
|
|
0
|
0
|
0
|
my ( $self, $target ) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
0
|
$target = substr($target,0,1) eq '+' |
|
68
|
|
|
|
|
|
|
? substr($target,1) |
|
69
|
|
|
|
|
|
|
: 'Markdown::Compiler::Target::' . $target; |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
0
|
return use_module("$target")->new( tree => $self->tree ); |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has result => ( |
|
75
|
|
|
|
|
|
|
is => 'ro', |
|
76
|
|
|
|
|
|
|
lazy => 1, |
|
77
|
|
|
|
|
|
|
builder => sub { |
|
78
|
64
|
|
|
64
|
|
1308
|
shift->compiler->result; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
has metadata => ( |
|
83
|
|
|
|
|
|
|
is => 'ro', |
|
84
|
|
|
|
|
|
|
lazy => 1, |
|
85
|
|
|
|
|
|
|
builder => sub { |
|
86
|
2
|
|
|
2
|
|
20
|
my ( $self ) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Process YAML files with YAML::XS. |
|
89
|
2
|
50
|
|
|
|
29
|
if ( $self->_source->metatype eq 'YAML' ) { |
|
90
|
2
|
|
|
|
|
43
|
return Load( $self->_source->metadata ); |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
return $self->_source->metadata; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |