line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Simpler::Aoh; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
338635
|
use Moo; |
|
5
|
|
|
|
|
58350
|
|
|
5
|
|
|
|
|
25
|
|
4
|
5
|
|
|
5
|
|
9763
|
use MooX::LazierAttributes; |
|
5
|
|
|
|
|
91306
|
|
|
5
|
|
|
|
|
24
|
|
5
|
5
|
|
|
5
|
|
3963
|
use Types::Standard qw/Str ArrayRef HashRef/; |
|
5
|
|
|
|
|
380145
|
|
|
5
|
|
|
|
|
50
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Pod::Simple'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
attributes( |
12
|
|
|
|
|
|
|
pod => [ rw, ArrayRef, { lzy_array, clr } ], |
13
|
|
|
|
|
|
|
section => [ rw, HashRef, { lzy_hash, clr } ], |
14
|
|
|
|
|
|
|
pod_elements => [ HashRef, { lzy, bld } ], |
15
|
|
|
|
|
|
|
element_name => [ rw, Str, { clr } ], |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _build_pod_elements { |
19
|
|
|
|
|
|
|
return { |
20
|
8
|
|
|
8
|
|
337
|
Document => 'skip', |
21
|
|
|
|
|
|
|
head1 => 'title', |
22
|
|
|
|
|
|
|
head2 => 'title', |
23
|
|
|
|
|
|
|
head2 => 'title', |
24
|
|
|
|
|
|
|
head4 => 'title', |
25
|
|
|
|
|
|
|
Para => 'content', |
26
|
|
|
|
|
|
|
'item-text' => 'content', |
27
|
|
|
|
|
|
|
'over-text' => 'content', |
28
|
|
|
|
|
|
|
Verbatim => 'content', |
29
|
|
|
|
|
|
|
Data => 'content', |
30
|
|
|
|
|
|
|
C => 'content', |
31
|
|
|
|
|
|
|
L => 'content', |
32
|
|
|
|
|
|
|
B => 'content', |
33
|
|
|
|
|
|
|
I => 'content', |
34
|
|
|
|
|
|
|
E => 'content', |
35
|
|
|
|
|
|
|
F => 'content', |
36
|
|
|
|
|
|
|
S => 'content', |
37
|
|
|
|
|
|
|
X => 'content', |
38
|
|
|
|
|
|
|
join => 'content', |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
for (qw/parse_file parse_from_file parse_string_document/) { |
43
|
|
|
|
|
|
|
around $_ => sub { |
44
|
|
|
|
|
|
|
my ( $orig, $self, $args ) = @_; |
45
|
|
|
|
|
|
|
$self->clear_pod; |
46
|
|
|
|
|
|
|
$self->$orig($args); |
47
|
|
|
|
|
|
|
return $self->pod; |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get { |
52
|
8
|
|
|
8
|
1
|
228
|
return $_[0]->pod->[ $_[1] ]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub aoh { |
56
|
0
|
|
|
0
|
1
|
0
|
return @{ $_[0]->pod }; |
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _handle_element_start { |
60
|
994
|
|
|
994
|
|
299464
|
$_[0]->element_name( $_[1] ); |
61
|
994
|
100
|
|
|
|
44178
|
if ( $_[0]->pod_elements->{ $_[1] } eq 'title' ) { |
62
|
|
|
|
|
|
|
$_[0]->section->{title} && $_[0]->section->{identifier} |
63
|
134
|
50
|
66
|
|
|
3262
|
and $_[0]->_insert_pod; |
64
|
|
|
|
|
|
|
not $_[0]->section->{identifier} |
65
|
134
|
50
|
|
|
|
3086
|
and $_[0]->section->{identifier} = $_[1]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub _handle_text { |
70
|
1181
|
|
100
|
1181
|
|
44235
|
my $el_name = $_[0]->element_name || 'join'; |
71
|
1181
|
|
|
|
|
26352
|
$_[0]->clear_element_name; |
72
|
1181
|
|
|
|
|
23260
|
my $pel = $_[0]->pod_elements->{$el_name}; |
73
|
1181
|
100
|
|
|
|
9855
|
if ($pel =~ m#content#) { |
|
|
50
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $el_args = { |
75
|
|
|
|
|
|
|
text => $_[1], |
76
|
|
|
|
|
|
|
element_name => $el_name, |
77
|
|
|
|
|
|
|
content => $_[0]->section->{content}, |
78
|
1047
|
|
|
|
|
18080
|
}; |
79
|
|
|
|
|
|
|
$_[0]->section->{content} = |
80
|
1047
|
|
|
|
|
8731
|
$_[0]->_parse_text( 'content', $el_args ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ($pel =~ m!title!) { |
83
|
134
|
|
|
|
|
2260
|
$_[0]->section->{title} = $_[1]; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _handle_element_end { |
88
|
994
|
100
|
|
994
|
|
14608
|
if ( $_[0]->source_dead ) { |
89
|
|
|
|
|
|
|
$_[0]->_insert_pod |
90
|
|
|
|
|
|
|
if $_[0]->section->{title} |
91
|
16
|
50
|
66
|
|
|
429
|
&& $_[0]->section->{identifier}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub _insert_pod { |
96
|
134
|
|
|
134
|
|
3954
|
push @{ $_[0]->pod }, $_[0]->section; |
|
134
|
|
|
|
|
2244
|
|
97
|
134
|
|
|
|
|
6090
|
return $_[0]->clear_section; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub _parse_text { |
101
|
1047
|
|
100
|
1047
|
|
3613
|
my $content = $_[2]->{$_[1]} || ''; |
102
|
1047
|
100
|
|
|
|
4664
|
if ( $_[2]->{element_name} =~ m{item-text|over-text} ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
103
|
96
|
|
|
|
|
2394
|
return sprintf "%s\n\n%s\n\n", $content, $_[2]->{text}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
# expecting a code example |
106
|
|
|
|
|
|
|
elsif ( $_[2]->{element_name} =~ m/Verbatim/ ) { |
107
|
61
|
100
|
|
|
|
1506
|
return $content ? sprintf "%s\n\n%s\n\n", $content, $_[2]->{text} : sprintf("%s\n\n", $_[2]->{text}); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
elsif ( $content =~ /[\;\.\:\*]$/ ) { |
110
|
158
|
|
|
|
|
3771
|
return sprintf "%s\n\n%s", $content, $_[2]->{text}; |
111
|
|
|
|
|
|
|
} |
112
|
732
|
100
|
|
|
|
16018
|
return $content ? sprintf "%s%s", $content, $_[2]->{text} : $_[2]->{text}; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
__END__ |