line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markaya; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
23020
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
5
|
1
|
|
|
1
|
|
14
|
use v5.8.3; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
52
|
|
6
|
1
|
|
|
1
|
|
930
|
use HTML::Entities; |
|
1
|
|
|
|
|
6855
|
|
|
1
|
|
|
|
|
98
|
|
7
|
1
|
|
|
1
|
|
953
|
use YAML::XS qw(); |
|
1
|
|
|
|
|
3560
|
|
|
1
|
|
|
|
|
378
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.40'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
13
|
0
|
|
|
|
|
|
return bless {}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load { |
17
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
my $str = shift; |
19
|
0
|
|
|
|
|
|
$self->{document} = YAML::XS::Load($str); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub to_html { |
23
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
24
|
0
|
|
|
|
|
|
_to_html($self->{document}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _to_html { |
28
|
0
|
|
|
0
|
|
|
my $node = shift; |
29
|
0
|
|
|
|
|
|
my $ret = ""; |
30
|
0
|
0
|
|
|
|
|
if (ref $node eq "ARRAY") { |
|
|
0
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
for my $child (@$node) { |
32
|
0
|
|
|
|
|
|
$ret .= _to_html($child) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
elsif(ref $node eq "HASH") { |
36
|
0
|
|
|
|
|
|
while(my ($k,$v) = each %$node) { |
37
|
0
|
|
|
|
|
|
my $attr_str=""; |
38
|
0
|
0
|
|
|
|
|
if (index($k, "=") != -1) { |
39
|
0
|
|
|
|
|
|
($k, my $attrs) = split(" ", $k, 2); |
40
|
0
|
|
|
|
|
|
my %attrs = (split(/=([^" ]+|"[^"]+") */, $attrs)); |
41
|
0
|
|
|
|
|
|
for(sort keys %attrs) { |
42
|
0
|
|
|
|
|
|
my $v = $attrs{$_}; |
43
|
0
|
|
|
|
|
|
$v =~ s/^"//; $v =~ s/"$//; |
|
0
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$v = encode_entities($v); |
45
|
0
|
|
|
|
|
|
$attr_str .= qq{ $_="$v"} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
0
|
|
|
|
|
|
$ret .= "<$k$attr_str>". _to_html($v) ."$k>"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
0
|
|
|
|
|
|
$ret .= encode_entities( $node ) |
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
|
return $ret; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |