| 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::SubSection; | ||
| 9 | use vars '$VERSION'; | ||
| 10 | $VERSION = '2.02'; | ||
| 11 | |||
| 12 | use base 'OODoc::Text::Structure'; | ||
| 13 | |||
| 14 | use strict; | ||
| 15 | use warnings; | ||
| 16 | |||
| 17 | use Log::Report 'oodoc'; | ||
| 18 | |||
| 19 | |||
| 20 | sub init($) | ||
| 21 | { my ($self, $args) = @_; | ||
| 22 | $args->{type} ||= 'Subsection'; | ||
| 23 | $args->{container} ||= delete $args->{section} or panic; | ||
| 24 | $args->{level} ||= 3; | ||
| 25 | |||
| 26 | $self->SUPER::init($args) or return; | ||
| 27 | $self->{OTS_subsubsections} = []; | ||
| 28 | $self; | ||
| 29 | } | ||
| 30 | |||
| 31 | sub emptyExtension($) | ||
| 32 | { my ($self, $container) = @_; | ||
| 33 | my $empty = $self->SUPER::emptyExtension($container); | ||
| 34 | my @subsub = map $_->emptyExtension($empty), $self->subsubsections; | ||
| 35 | $empty->subsubsections(@subsub); | ||
| 36 | $empty; | ||
| 37 | } | ||
| 38 | |||
| 39 | sub findEntry($) | ||
| 40 | { my ($self, $name) = @_; | ||
| 41 | $self->name eq $name ? $self : (); | ||
| 42 | } | ||
| 43 | |||
| 44 | #------------------------------------------- | ||
| 45 | |||
| 46 | |||
| 47 | sub section() { shift->container } | ||
| 48 | |||
| 49 | |||
| 50 | sub chapter() { shift->section->chapter } | ||
| 51 | |||
| 52 | sub path() | ||
| 53 | { my $self = shift; | ||
| 54 | $self->section->path . '/' . $self->name; | ||
| 55 | } | ||
| 56 | |||
| 57 | #------------------------------------------- | ||
| 58 | |||
| 59 | |||
| 60 | sub subsubsection($) | ||
| 61 | { my ($self, $thing) = @_; | ||
| 62 | |||
| 63 | if(ref $thing) | ||
| 64 | { push @{$self->{OTS_subsubsections}}, $thing; | ||
| 65 | return $thing; | ||
| 66 | } | ||
| 67 | |||
| 68 | first {$_->name eq $thing} $self->subsubsections; | ||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | sub subsubsections(;@) | ||
| 73 | { my $self = shift; | ||
| 74 | if(@_) | ||
| 75 | { $self->{OTS_subsubsections} = [ @_ ]; | ||
| 76 | $_->container($self) for @_; | ||
| 77 | } | ||
| 78 | |||
| 79 | @{$self->{OTS_subsubsections}}; | ||
| 80 | } | ||
| 81 | |||
| 82 | |||
| 83 | 1; | ||
| 84 | |||
| 85 | 1; |