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.103006
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 This library should run on perls released even a long time ago. It
58 should work on any version of perl released in the last five years.
59
60 Although it may work on older versions of perl, no guarantee is made
61 that the minimum required version will not be increased. The version
62 may be increased for any reason, and there is no promise that patches
63 will be accepted to lower the minimum required perl.
64
66 top_selector
67 This attribute must be a coderef (presumably made from
68 Pod::Elemental::Selectors) that will test elements in the transformed
69 node and return true if the element is a potential new container.
70
71 content_selectors
72 This attribute must be an arrayref of coderefs (again presumably made
73 from Pod::Elemental::Selectors) that will test whether paragraphs
74 subsequent to the top-level container may be moved under the container.
75
77 Ricardo SIGNES <cpan@semiotic.systems>
78
80 This software is copyright (c) 2022 by Ricardo SIGNES.
81
82 This is free software; you can redistribute it and/or modify it under
83 the same terms as the Perl 5 programming language system itself.
84
85
86
87perl v5.36.0 2023-01P-o2d0::Elemental::Transformer::Nester(3)