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