File: SeeAlsoMason.pm

package info (click to toggle)
libhtml-mason-perl 1%3A1.58-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,796 kB
  • sloc: perl: 8,618; sh: 49; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 996 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package inc::Pod::Weaver::Section::SeeAlsoMason;
use Moose;
with 'Pod::Weaver::Role::Section';

use Moose::Autobox;

# Add "SEE ALSO: Mason"

sub weave_section {
    my ( $self, $document, $input ) = @_;

    return if $input->{filename} =~ m{\QHTML/Mason.pm};

    my $idc = $input->{pod_document}->children;
    for ( my $i = 0 ; $i < $idc->length ; $i++ ) {
        next unless my $para = $idc->[$i];
        return
          if $para->can('command')
              && $para->command eq 'head1'
              && $para->content eq 'SEE ALSO';
    }
    $document->children->push(
        Pod::Elemental::Element::Nested->new(
            {
                command  => 'head1',
                content  => 'SEE ALSO',
                children => [
                    Pod::Elemental::Element::Pod5::Ordinary->new(
                        { content => "L<Mason|Mason>" }
                    ),
                ],
            }
        ),
    );
}

__PACKAGE__->meta->make_immutable;

no Moose;
1;