line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2170
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
6
|
|
|
2
|
|
|
|
|
79
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
54
|
|
|
2
|
|
|
|
|
91
|
|
2
|
|
|
|
|
|
|
package Kwim::Markdown; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
13
|
use base 'Kwim::Markup'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
230
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# use XXX -with => 'YAML::XS'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use constant top_block_separator => "\n"; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1965
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub render_text { |
11
|
40
|
|
|
40
|
0
|
106
|
my ($self, $text) = @_; |
12
|
40
|
|
|
|
|
87
|
$text =~ s/\n/ /g; |
13
|
40
|
|
|
|
|
130
|
return $text; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub render_para { |
17
|
17
|
|
|
17
|
0
|
33
|
my ($self, $node) = @_; |
18
|
17
|
|
|
|
|
65
|
my $out = $self->render($node); |
19
|
17
|
|
|
|
|
58
|
return "$out\n"; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub render_title { |
23
|
2
|
|
|
2
|
0
|
6
|
my ($self, $node, $number) = @_; |
24
|
2
|
50
|
|
|
|
10
|
my ($name, $abstract) = ref $node ? @$node : (undef, $node); |
25
|
2
|
|
|
|
|
9
|
$name = $self->render($name); |
26
|
2
|
|
|
|
|
10
|
my $under = '=' x length $name; |
27
|
2
|
100
|
|
|
|
7
|
if (defined $abstract) { |
28
|
1
|
|
|
|
|
5
|
$abstract = $self->render($abstract); |
29
|
1
|
|
|
|
|
8
|
"$name\n$under\n\n$abstract\n"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else { |
32
|
1
|
|
|
|
|
5
|
"$name\n$under\n"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub render_head { |
37
|
4
|
|
|
4
|
0
|
10
|
my ($self, $node, $number) = @_; |
38
|
4
|
|
|
|
|
14
|
my $out = $self->render($node); |
39
|
4
|
|
|
|
|
8
|
my $len = length $out; |
40
|
4
|
|
|
|
|
24
|
('#' x $number) . " $out\n"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub render_list { |
46
|
2
|
|
|
2
|
0
|
5
|
my ($self, $node) = @_; |
47
|
2
|
|
|
|
|
5
|
push @{$self->{bullet}}, '*'; |
|
2
|
|
|
|
|
5
|
|
48
|
2
|
|
|
|
|
9
|
my $out = $self->render($node); |
49
|
2
|
|
|
|
|
3
|
pop @{$self->{bullet}}; |
|
2
|
|
|
|
|
5
|
|
50
|
2
|
|
|
|
|
5
|
$out; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub render_item { |
54
|
5
|
|
|
5
|
0
|
11
|
my ($self, $node) = @_; |
55
|
5
|
|
|
|
|
11
|
my $item = shift @$node; |
56
|
5
|
|
|
|
|
12
|
my $bullet = $self->{bullet}[-1]; |
57
|
5
|
|
|
|
|
16
|
my $out = "$bullet " . $self->render($item) . "\n"; |
58
|
5
|
|
|
|
|
15
|
$out .= $self->render($node); |
59
|
5
|
|
|
|
|
8
|
my $indent = ' ' x (@{$self->{bullet}} - 1); |
|
5
|
|
|
|
|
14
|
|
60
|
5
|
|
|
|
|
22
|
$out =~ s/^/$indent/gm; |
61
|
5
|
|
|
|
|
17
|
$out; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub render_pref { |
65
|
2
|
|
|
2
|
0
|
7
|
my ($self, $node) = @_; |
66
|
2
|
100
|
|
|
|
5
|
return '' if @{$self->{bullet}}; |
|
2
|
|
|
|
|
12
|
|
67
|
1
|
|
|
|
|
5
|
my $out = "$node\n"; |
68
|
1
|
|
|
|
|
6
|
$out =~ s/^/ /gm; |
69
|
1
|
|
|
|
|
4
|
$out; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
5
|
|
|
5
|
0
|
11
|
sub render_blank { '' } |
73
|
|
|
|
|
|
|
|
74
|
3
|
|
|
3
|
0
|
8
|
sub render_comment { '' } |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub render_bold { |
77
|
3
|
|
|
3
|
0
|
9
|
my ($self, $node) = @_; |
78
|
3
|
|
|
|
|
15
|
my $out = $self->render($node); |
79
|
3
|
|
|
|
|
15
|
"**$out**"; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub render_emph { |
83
|
2
|
|
|
2
|
0
|
9
|
my ($self, $node) = @_; |
84
|
2
|
|
|
|
|
8
|
my $out = $self->render($node); |
85
|
2
|
|
|
|
|
10
|
"_$out\_"; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub render_code { |
89
|
1
|
|
|
1
|
0
|
4
|
my ($self, $node) = @_; |
90
|
1
|
|
|
|
|
6
|
my $out = $self->render($node); |
91
|
1
|
|
|
|
|
6
|
"`$out`"; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub render_hyper { |
95
|
3
|
|
|
3
|
0
|
8
|
my ($self, $node) = @_; |
96
|
3
|
|
|
|
|
8
|
my ($link, $text) = @{$node}{qw(link text)}; |
|
3
|
|
|
|
|
10
|
|
97
|
3
|
100
|
|
|
|
21
|
(length $text == 0) |
98
|
|
|
|
|
|
|
? "<$link>" |
99
|
|
|
|
|
|
|
: "[$text]($link)"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub render_link { |
103
|
0
|
|
|
0
|
0
|
|
my ($self, $node) = @_; |
104
|
0
|
|
|
|
|
|
my ($link, $text) = @{$node}{qw(link text)}; |
|
0
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
(length $text == 0) |
106
|
|
|
|
|
|
|
? "[$link]($link)" |
107
|
|
|
|
|
|
|
: "[$text]($link)"; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |