File Coverage

blib/lib/Pod/Weaver/Plugin/H1Nester.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 0 1 0.0
total 40 41 97.5


line stmt bran cond sub pod time code
1             package Pod::Weaver::Plugin::H1Nester 4.019;
2             # ABSTRACT: structure the input pod document into head1-grouped sections
3              
4 9     9   66 use Moose;
  9         22  
  9         95  
5             with 'Pod::Weaver::Role::Transformer';
6              
7             # BEGIN BOILERPLATE
8 9     9   68409 use v5.20.0;
  9         32  
9 9     9   57 use warnings;
  9         21  
  9         424  
10 9     9   61 use utf8;
  9         18  
  9         57  
11 9     9   273 no feature 'switch';
  9         28  
  9         788  
12 9     9   63 use experimental qw(postderef postderef_qq); # This experiment gets mainlined.
  9         29  
  9         59  
13             # END BOILERPLATE
14              
15 9     9   844 use namespace::autoclean;
  9         21  
  9         83  
16              
17 9     9   866 use Pod::Elemental::Selectors -all;
  9         20  
  9         127  
18 9     9   8426 use Pod::Elemental::Transformer::Nester;
  9         690273  
  9         1858  
19              
20             #pod =head1 OVERVIEW
21             #pod
22             #pod This plugin is very, very simple: it uses the
23             #pod L<Pod::Elemental::Transformer::Nester> to restructure the document under its
24             #pod C<=head1> elements.
25             #pod
26             #pod =cut
27              
28             sub transform_document {
29 29     29 0 117 my ($self, $document) = @_;
30              
31 29         191 my $nester = Pod::Elemental::Transformer::Nester->new({
32             top_selector => s_command([ qw(head1) ]),
33             content_selectors => [
34             s_flat,
35             s_command( [ qw(head2 head3 head4 over item back) ]),
36             ],
37             });
38              
39 29         4966 $nester->transform_node($document);
40              
41 29         142194 return;
42             }
43              
44             __PACKAGE__->meta->make_immutable;
45             1;
46              
47             __END__
48              
49             =pod
50              
51             =encoding UTF-8
52              
53             =head1 NAME
54              
55             Pod::Weaver::Plugin::H1Nester - structure the input pod document into head1-grouped sections
56              
57             =head1 VERSION
58              
59             version 4.019
60              
61             =head1 OVERVIEW
62              
63             This plugin is very, very simple: it uses the
64             L<Pod::Elemental::Transformer::Nester> to restructure the document under its
65             C<=head1> elements.
66              
67             =head1 PERL VERSION
68              
69             This module should work on any version of perl still receiving updates from
70             the Perl 5 Porters. This means it should work on any version of perl released
71             in the last two to three years. (That is, if the most recently released
72             version is v5.40, then this module should work on both v5.40 and v5.38.)
73              
74             Although it may work on older versions of perl, no guarantee is made that the
75             minimum required version will not be increased. The version may be increased
76             for any reason, and there is no promise that patches will be accepted to lower
77             the minimum required perl.
78              
79             =head1 AUTHOR
80              
81             Ricardo SIGNES <cpan@semiotic.systems>
82              
83             =head1 COPYRIGHT AND LICENSE
84              
85             This software is copyright (c) 2023 by Ricardo SIGNES.
86              
87             This is free software; you can redistribute it and/or modify it under
88             the same terms as the Perl 5 programming language system itself.
89              
90             =cut