1Pod::Elemental::TransfoUrsmeerr:C:oNnetsrtiebru(t3e)d PeProld:D:oEcluemmeennttaatli:o:nTransformer::Nester(3)
2
3
4
6 Pod::Elemental::Transformer::Nester - group the document into sections
7
9 version 0.103005
10
12 The Nester transformer is meant to find potential container elements
13 and make them into actual containers. It works by being told what
14 elements may be made into containers and what subsequent elements they
15 should allow to be stuffed into them.
16
17 For example, given the following nester:
18
19 use Pod::Elemental::Selectors qw(s_command s_flat);
20
21 my $nester = Pod::Elemental::Transformer::Nester->new({
22 top_selector => s_command('head1'),
23 content_selectors => [
24 s_command([ qw(head2 head3 head4) ]),
25 s_flat,
26 ],
27 });
28
29 ..then when we apply the transformation:
30
31 $nester->transform_node($document);
32
33 ...the nester will find all "=head1" elements in the top-level of the
34 document. It will ensure that they are represented by objects that
35 perform the Pod::Elemental::Node role, and then it will move all
36 subsequent elements matching the "content_selectors" into the
37 container.
38
39 So, if we start with this input:
40
41 =head1 Header
42 =head2 Subheader
43 Pod5::Ordinary <some content>
44 =head1 New Header
45
46 The nester will convert its structure to look like this:
47
48 =head1 Header
49 =head2 Subheader
50 Pod5::Ordinary <some content>
51 =head1 New Header
52
53 Once an element is reached that does not pass the content selectors,
54 the nesting ceases until the next potential container.
55
57 top_selector
58 This attribute must be a coderef (presumably made from
59 Pod::Elemental::Selectors) that will test elements in the transformed
60 node and return true if the element is a potential new container.
61
62 content_selectors
63 This attribute must be an arrayref of coderefs (again presumably made
64 from Pod::Elemental::Selectors) that will test whether paragraphs
65 subsequent to the top-level container may be moved under the container.
66
68 Ricardo SIGNES <rjbs@cpan.org>
69
71 This software is copyright (c) 2020 by Ricardo SIGNES.
72
73 This is free software; you can redistribute it and/or modify it under
74 the same terms as the Perl 5 programming language system itself.
75
76
77
78perl v5.34.0 2022-01P-o2d1::Elemental::Transformer::Nester(3)