File Coverage

blib/lib/Pod/Elemental/Element/Nested.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Pod::Elemental::Element::Nested;
2             # ABSTRACT: an element that is a command and a node
3             $Pod::Elemental::Element::Nested::VERSION = '0.103005';
4 3     3   635 use Moose;
  3         11  
  3         22  
5             extends 'Pod::Elemental::Element::Generic::Command';
6             with 'Pod::Elemental::Node';
7             with 'Pod::Elemental::Autochomp';
8              
9 3     3   20115 use namespace::autoclean;
  3         7  
  3         27  
10              
11             # BEGIN Autochomp Replacement
12 3     3   260 use Pod::Elemental::Types qw(ChompedString);
  3         7  
  3         27  
13             has '+content' => (coerce => 1, isa => ChompedString);
14             # END Autochomp Replacement
15              
16             #pod =head1 WARNING
17             #pod
18             #pod This class is somewhat sketchy and may be refactored somewhat in the future,
19             #pod specifically to refactor its similarities to
20             #pod L<Pod::Elemental::Element::Pod5::Region>.
21             #pod
22             #pod =head1 OVERVIEW
23             #pod
24             #pod A Nested element is a Generic::Command element that is also a node.
25             #pod
26             #pod It's used by the nester transformer to produce commands with children, to make
27             #pod documents seem more structured for easy manipulation.
28             #pod
29             #pod =cut
30              
31             override as_pod_string => sub {
32             my ($self) = @_;
33              
34             my $string = super;
35              
36             $string = join q{},
37             "$string\n\n",
38             map { $_->as_pod_string } @{ $self->children };
39              
40             $string =~ s/\n{3,}\z/\n\n/g;
41              
42             return $string;
43             };
44              
45             __PACKAGE__->meta->make_immutable;
46              
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =encoding UTF-8
54              
55             =head1 NAME
56              
57             Pod::Elemental::Element::Nested - an element that is a command and a node
58              
59             =head1 VERSION
60              
61             version 0.103005
62              
63             =head1 OVERVIEW
64              
65             A Nested element is a Generic::Command element that is also a node.
66              
67             It's used by the nester transformer to produce commands with children, to make
68             documents seem more structured for easy manipulation.
69              
70             =head1 WARNING
71              
72             This class is somewhat sketchy and may be refactored somewhat in the future,
73             specifically to refactor its similarities to
74             L<Pod::Elemental::Element::Pod5::Region>.
75              
76             =head1 AUTHOR
77              
78             Ricardo SIGNES <rjbs@cpan.org>
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is copyright (c) 2020 by Ricardo SIGNES.
83              
84             This is free software; you can redistribute it and/or modify it under
85             the same terms as the Perl 5 programming language system itself.
86              
87             =cut