File: README

package info (click to toggle)
libpod-weaver-section-generatesection-perl 1.06-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 160 kB
  • ctags: 3
  • sloc: perl: 298; makefile: 2
file content (124 lines) | stat: -rw-r--r-- 3,924 bytes parent folder | download
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
SYNOPSIS

    In your weaver.ini

      [GenerateSection]
      title = HOMEPAGE
      text  = This is the POD for distribution {{$name}}. Check out what we have
      text  = been up to at {{$homepage}}

    The title value can be omited if passed as the plugin name:

      [GenerateSection / HOMEPAGE]

DESCRIPTION

    This plugin attempts to be a cross between
    Pod::Weaver::Section::Template and Dist::Zilla::Plugin::GenerateFile
    without the generation of extra files.

    The values of text are concatenated and variable names with matching
    values on the distribution are interpolated. Specifying the heading
    level allows one to write down a rather long section of POD text
    without need for extra files. For example:

      [GenerateSection / FEEDBACK]
      head = 1
      [GenerateSection / Reporting bugs]
      head = 2
      text = Please report bugs when you find them. While we do have a mailing
      text = list, please use the bug tracker at {{$bugtracker_web}}
      text = to report bugs
      [GenerateSection / Homegape]
      head = 2
      text = Also, come check out our other projects at
      text = {{$homepage}}

    The text to be added to the section. Multiple values are allowed and
    will be concatenated. Certain sequences on the text will be replaced
    (see below).

    sub mvp_multivalue_args { return qw(text) } has text => ( is => 'lazy',
    isa => ArrayRef, default => sub { [] }, );

    The heading level of this section. If 0, there will be no heading.
    Defaults to 1. =attr title

    The title for this section. It can optionally be omitted and passed as
    the plugin name. =attr main_module_only

    If true, it will add the text only to the main module POD. Defaults to
    false. =attr is_template

    If false, it will not attempt to replace the {{}} entries on text.
    Defaults to true. =head1 Text as template

    Unless the option is_template is false, the text will be run through
    Text::Template. The variables $plugin, $dist, and $distmeta will be
    provided, set to the GenerateSection plugin, Dist::Zilla object, and
    the distribution metadata hash respectively. For convenience, the
    following variables are also set:

    $name

    $version

    $homepage

    $repository_web

    $repository_url

    $bugtracker_web

    $bugtracker_email

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

      if ($self->main_module_only) {
        return if $input->{zilla}->main_module->name ne $input->{filename};
      }
    
      my $text = join ("\n", @{ $self->text });
      if ($self->is_template) {
        $text = $self->fill_in_string($text,
        {
          dist      => \($input->{zilla}),
          distmeta  => \($input->{distmeta}),
          plugin    => \($self),
    
          name        => $input->{distmeta}->{name},
          version     => $input->{distmeta}->{version},
          homepage    => $input->{distmeta}->{resources}->{homepage},
          repository_web   => $input->{distmeta}->{resources}->{repository}->{web},
          repository_url   => $input->{distmeta}->{resources}->{repository}->{url},
          bugtracker_web   => $input->{distmeta}->{resources}->{bugtracker}->{web},
          bugtracker_email => $input->{distmeta}->{resources}->{bugtracker}->{mailto},
        });
      }
      $text = Pod::Elemental::Element::Pod5::Ordinary->new({ content => $text });
      if ($self->head) {
        $text = Pod::Elemental::Element::Nested->new({
          command  => "head" . $self->head,
          content  => $self->title,
          children => [$text],
        });
      }
      push @{ $document->children }, $text;
    }

    __PACKAGE__->meta->make_immutable; 1;

POD ERRORS

    Hey! The above document had some coding errors, which are explained
    below:

    Around line 36:

      Unknown directive: =attr

    Around line 49:

      Unknown directive: =attr