line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2003-2021 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of perl distribution OODoc. It is licensed under the |
6
|
|
|
|
|
|
|
# same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package OODoc::Text::Section; |
9
|
1
|
|
|
1
|
|
1171
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
10
|
|
|
|
|
|
|
$VERSION = '2.02'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use base 'OODoc::Text::Structure'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
100
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
5
|
use Log::Report 'oodoc'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
18
|
1
|
|
|
1
|
|
250
|
use List::Util 'first'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
703
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub init($) |
22
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
23
|
0
|
|
0
|
|
|
|
$args->{type} ||= 'Section'; |
24
|
0
|
|
0
|
|
|
|
$args->{level} ||= 2; |
25
|
0
|
0
|
0
|
|
|
|
$args->{container} ||= delete $args->{chapter} or panic; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
$self->SUPER::init($args) or return; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$self->{OTS_subsections} = []; |
30
|
0
|
|
|
|
|
|
$self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub emptyExtension($) |
34
|
0
|
|
|
0
|
1
|
|
{ my ($self, $container) = @_; |
35
|
0
|
|
|
|
|
|
my $empty = $self->SUPER::emptyExtension($container); |
36
|
0
|
|
|
|
|
|
my @subsections = map $_->emptyExtension($empty), $self->subsections; |
37
|
0
|
|
|
|
|
|
$empty->subsections(@subsections); |
38
|
0
|
|
|
|
|
|
$empty; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#------------------------------------------- |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub chapter() { shift->container } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub path() |
47
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
48
|
0
|
|
|
|
|
|
$self->chapter->path . '/' . $self->name; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub findSubroutine($) |
52
|
0
|
|
|
0
|
0
|
|
{ my ($self, $name) = @_; |
53
|
0
|
|
|
|
|
|
my $sub = $self->SUPER::findSubroutine($name); |
54
|
0
|
0
|
|
|
|
|
return $sub if defined $sub; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
foreach my $subsection ($self->subsections) |
57
|
0
|
|
|
|
|
|
{ my $sub = $subsection->findSubroutine($name); |
58
|
0
|
0
|
|
|
|
|
return $sub if defined $sub; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
undef; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub findEntry($) |
65
|
0
|
|
|
0
|
1
|
|
{ my ($self, $name) = @_; |
66
|
0
|
0
|
|
|
|
|
return $self if $self->name eq $name; |
67
|
0
|
|
|
|
|
|
my $subsect = $self->subsection($name); |
68
|
0
|
0
|
|
|
|
|
defined $subsect ? $subsect : (); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub all($@) |
72
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
73
|
0
|
|
|
|
|
|
($self->SUPER::all(@_), map {$_->all(@_)} $self->subsections); |
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#------------------------------------------- |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub subsection($) |
80
|
0
|
|
|
0
|
1
|
|
{ my ($self, $thing) = @_; |
81
|
0
|
0
|
|
|
|
|
if(ref $thing) |
82
|
0
|
|
|
|
|
|
{ push @{$self->{OTS_subsections}}, $thing; |
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return $thing; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
0
|
|
|
first {$_->name eq $thing} $self->subsections; |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub subsections(;@) |
91
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
92
|
0
|
0
|
|
|
|
|
if(@_) |
93
|
0
|
|
|
|
|
|
{ $self->{OTS_subsections} = [ @_ ]; |
94
|
0
|
|
|
|
|
|
$_->container($self) for @_; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
@{$self->{OTS_subsections}}; |
|
0
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |