| 1 | package Pod::Weaver::Plugin::H1Nester 4.022; | ||
| 2 | # ABSTRACT: structure the input pod document into head1-grouped sections | ||
| 3 | |||
| 4 | 9 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 9 | with 'Pod::Weaver::Role::Transformer'; | |
| 6 | |||
| 7 | # BEGIN BOILERPLATE | ||
| 8 | 9 | ▶ | use v5.22.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 9 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 9 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 9 | ▶ | no feature 'switch'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 9 | ▶ | use experimental qw(postderef postderef_qq); # This experiment gets mainlined. |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | # END BOILERPLATE | ||
| 14 | |||
| 15 | 9 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 9 | ▶ | use Pod::Elemental::Selectors -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | 9 | ▶ | use Pod::Elemental::Transformer::Nester; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 | 29 | ▶ | sub transform_document { |
|
Subroutine
transform_document: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 29 | 29 | my ($self, $document) = @_; | |
| 30 | |||
| 31 | 29 | 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 | $nester->transform_node($document); | |
| 40 | |||
| 41 | 29 | return; | |
| 42 | } | ||
| 43 | |||
| 44 | 9 | __PACKAGE__->meta->make_immutable; | |
| 45 | 9 | 1; | |
| 46 | |||
| 47 | __END__ | ||