line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
767
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
2
|
|
|
|
|
|
|
package Swim::Byte; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use base 'Swim::Markup'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
409
|
|
5
|
|
|
|
|
|
|
# use XXX -with => 'YAML::XS'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub render_node { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $hash) = @_; |
9
|
0
|
|
|
|
|
|
my ($tag, $node) = each %$hash; |
10
|
0
|
0
|
|
|
|
|
if ($self->can("render_$tag")) { |
11
|
0
|
|
|
|
|
|
my $method = "render_$tag"; |
12
|
0
|
|
|
|
|
|
return $self->$method($node); |
13
|
|
|
|
|
|
|
} |
14
|
0
|
0
|
|
|
|
|
if (not defined $node) { |
15
|
0
|
|
|
|
|
|
"=$tag\n" |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
0
|
|
|
|
|
|
"+$tag\n" . $self->render($node) . "-$tag\n"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub render_text { |
23
|
0
|
|
|
0
|
0
|
|
my ($self, $node) = @_; |
24
|
0
|
0
|
|
|
|
|
return '' unless length $node; |
25
|
0
|
|
|
|
|
|
$node =~ s/\n/\\n/g; |
26
|
0
|
|
|
|
|
|
" $node\n"; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub render_title { |
30
|
0
|
|
|
0
|
0
|
|
my ($self, $node) = @_; |
31
|
0
|
0
|
|
|
|
|
my ($name, $abstract) = ref $node ? @$node : (undef, $node); |
32
|
0
|
0
|
|
|
|
|
$name = @$name > 1 ? $self->render($name) : $name->[0]; |
33
|
0
|
0
|
|
|
|
|
if (defined $abstract) { |
34
|
0
|
0
|
|
|
|
|
$abstract = @$abstract > 1 ? $self->render($abstract) : $abstract->[0]; |
35
|
0
|
|
|
|
|
|
"+title\n $name\n-title\n+para\n $abstract\n-para\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
|
|
|
|
|
"+title\n $name\n-title\n"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub render_hyper { |
43
|
0
|
|
|
0
|
0
|
|
my ($self, $node) = @_; |
44
|
0
|
|
|
|
|
|
my ($link, $text) = @{$node}{qw(link text)}; |
|
0
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
(length $text == 0) |
46
|
|
|
|
|
|
|
? "=hyper $link\n" |
47
|
|
|
|
|
|
|
: "+hyper $link\n $text\n-hyper\n"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |