line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2003-2021 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of perl distribution OODoc. It is licensed under the |
6
|
|
|
|
|
|
|
# same terms as Perl itself: https://spdx.org/licenses/Artistic-2.0.html |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
947
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package OODoc::Format::Pod3; |
12
|
1
|
|
|
1
|
|
5
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
13
|
|
|
|
|
|
|
$VERSION = '2.02'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
6
|
use base 'OODoc::Format::Pod'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
96
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
9
|
use Log::Report 'oodoc'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
301
|
use OODoc::Template (); |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
23
|
|
20
|
1
|
|
|
1
|
|
5
|
use List::Util qw/first/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1683
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $default_template; |
24
|
|
|
|
|
|
|
{ local $/; |
25
|
|
|
|
|
|
|
$default_template = ; |
26
|
|
|
|
|
|
|
close DATA; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub createManual(@) |
30
|
0
|
|
|
0
|
1
|
|
{ my ($self, %args) = @_; |
31
|
0
|
|
0
|
|
|
|
$self->{O_template} = delete $args{template} || \$default_template; |
32
|
0
|
|
|
|
|
|
$self->SUPER::createManual(%args); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub formatManual(@) |
36
|
0
|
|
|
0
|
1
|
|
{ my ($self, %args) = @_; |
37
|
0
|
|
|
|
|
|
my $output = delete $args{output}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $template = OODoc::Template->new |
40
|
|
|
|
|
|
|
( markers => [ '<{', '}>' ] |
41
|
|
|
|
|
|
|
, manual_obj => delete $args{manual} |
42
|
0
|
|
|
|
|
|
, chapter_order => |
43
|
|
|
|
|
|
|
[ qw/NAME INHERITANCE SYNOPSIS DESCRIPTION OVERLOADED METHODS |
44
|
|
|
|
|
|
|
FUNCTIONS CONSTANTS EXPORTS DIAGNOSTICS DETAILS REFERENCES |
45
|
|
|
|
|
|
|
COPYRIGHTS/ |
46
|
|
|
|
|
|
|
] |
47
|
|
|
|
|
|
|
, %args |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$output->print |
51
|
|
|
|
|
|
|
( scalar $template->process |
52
|
|
|
|
|
|
|
( $self->{O_template} |
53
|
0
|
|
|
0
|
|
|
, manual => sub { shift; ( {}, @_ ) } |
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
|
|
, chapters => sub { $self->chapters($template, @_) } |
55
|
0
|
|
|
0
|
|
|
, sections => sub { $self->sections($template, @_) } |
56
|
0
|
|
|
0
|
|
|
, subsections => sub { $self->subsections($template, @_) } |
57
|
0
|
|
|
0
|
|
|
, subsubsections => sub { $self->subsubsections($template, @_) } |
58
|
0
|
|
|
0
|
|
|
, subroutines => sub { $self->subroutines($template, @_) } |
59
|
0
|
|
|
0
|
|
|
, diagnostics => sub { $self->diagnostics($template, @_) } |
60
|
|
|
|
|
|
|
) |
61
|
0
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub structure($$$) |
66
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $type, $object) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $manual = $template->valueFor('manual_obj'); |
69
|
0
|
|
|
|
|
|
my $descr = $self->cleanup($manual, $object->description); |
70
|
0
|
|
|
|
|
|
my $name = $object->name; |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
0
|
|
|
|
$descr =~ s/\n*$/\n\n/ |
73
|
|
|
|
|
|
|
if defined $descr && length $descr; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my @examples; |
76
|
0
|
|
|
|
|
|
foreach my $example ($object->examples) |
77
|
0
|
|
0
|
|
|
|
{ my $title = $example->name || 'Example'; |
78
|
0
|
0
|
|
|
|
|
$title = "Example: $example" if $title !~ /example/i; |
79
|
0
|
|
|
|
|
|
$title =~ s/\s+$//; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
push @examples, |
82
|
|
|
|
|
|
|
+{ title => $title |
83
|
|
|
|
|
|
|
, descr => $self->cleanup($manual, $example->description) |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my @extends; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
0
|
|
|
|
unless($name eq 'NAME' || $name eq 'SYNOPSIS') |
90
|
0
|
|
|
|
|
|
{ @extends = map +{manual => $_->manual, header => $name} |
91
|
|
|
|
|
|
|
, $object->extends; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
+{ $type => $name |
95
|
|
|
|
|
|
|
, $type.'_obj' => $object |
96
|
|
|
|
|
|
|
, description => $descr |
97
|
|
|
|
|
|
|
, examples => \@examples |
98
|
|
|
|
|
|
|
, extends => \@extends |
99
|
|
|
|
|
|
|
}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub chapters($$$$$) |
103
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
104
|
0
|
|
|
|
|
|
my $manual = $template->valueFor('manual_obj'); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my @chapters |
107
|
0
|
|
|
|
|
|
= map $self->structure($template, chapter => $_) |
108
|
|
|
|
|
|
|
, $manual->chapters; |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
if(my $order = $attrs->{order}) |
111
|
0
|
0
|
|
|
|
|
{ my @order = ref $order eq 'ARRAY' ? @$order : split( /\,\s*/, $order); |
112
|
0
|
|
|
|
|
|
my %order; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# first the pre-defined names, then the other |
115
|
0
|
|
|
|
|
|
my $count = 1; |
116
|
0
|
|
|
|
|
|
$order{$_} = $count++ for @order; |
117
|
0
|
|
0
|
|
|
|
$order{$_->{chapter}} ||= $count++ for @chapters; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
@chapters = sort { $order{$a->{chapter}} <=> $order{$b->{chapter}} } |
|
0
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
@chapters; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
( \@chapters, $attrs, $then, $else ); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub sections($$$$$) |
127
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
128
|
0
|
|
|
|
|
|
my $chapter = $template->valueFor('chapter_obj'); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
return ([], $attrs, $then, $else) |
131
|
0
|
0
|
|
0
|
|
|
unless first {!$_->isEmpty} $chapter->sections; |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
my @sections |
134
|
0
|
|
|
|
|
|
= map { $self->structure($template, section => $_) } |
|
0
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$chapter->sections; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
( \@sections, $attrs, $then, $else ); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub subsections($$$$$) |
141
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
142
|
0
|
|
|
|
|
|
my $section = $template->valueFor('section_obj'); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
return ([], $attrs, $then, $else) |
145
|
0
|
0
|
|
0
|
|
|
unless first {!$_->isEmpty} $section->subsections; |
|
0
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my @subsections |
148
|
0
|
|
|
|
|
|
= map { $self->structure($template, subsection => $_) } |
|
0
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
$section->subsections; |
150
|
|
|
|
|
|
|
|
151
|
0
|
|
|
|
|
|
( \@subsections, $attrs, $then, $else ); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub subsubsections($$$$$) |
155
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
156
|
0
|
|
|
|
|
|
my $subsection = $template->valueFor('subsection_obj'); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
return ([], $attrs, $then, $else) |
159
|
0
|
0
|
|
0
|
|
|
unless first {!$_->isEmpty} $subsection->subsubsections; |
|
0
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
my @subsubsections |
162
|
0
|
|
|
|
|
|
= map { $self->structure($template, subsubsection => $_) } |
|
0
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
$subsection->subsubsections; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
( \@subsubsections, $attrs, $then, $else ); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub subroutines($$$$$$) |
169
|
0
|
|
|
0
|
1
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
0
|
|
|
|
my $parent |
172
|
|
|
|
|
|
|
= $template->valueFor('subsubsection_obj') |
173
|
|
|
|
|
|
|
|| $template->valueFor('subsection_obj') |
174
|
|
|
|
|
|
|
|| $template->valueFor('section_obj') |
175
|
|
|
|
|
|
|
|| $template->valueFor('chapter_obj'); |
176
|
|
|
|
|
|
|
|
177
|
0
|
0
|
|
|
|
|
defined $parent |
178
|
|
|
|
|
|
|
or return (); |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
my $out = ''; |
181
|
0
|
|
|
|
|
|
open OUT, '>',\$out; |
182
|
|
|
|
|
|
|
|
183
|
0
|
|
|
|
|
|
my @show = map +($_ => scalar $template->valueFor($_)), |
184
|
|
|
|
|
|
|
qw/show_described_options show_described_subs show_diagnostics |
185
|
|
|
|
|
|
|
show_examples show_inherited_options show_inherited_subs |
186
|
|
|
|
|
|
|
show_option_table show_subs_index/; |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
# This is quite weak: the whole POD section for a sub description |
189
|
|
|
|
|
|
|
# is produced outside the template. In the future, this may get |
190
|
|
|
|
|
|
|
# changed: if there is a need for it: of course, we can do everything |
191
|
|
|
|
|
|
|
# in the template system. |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
$self->showSubroutines |
194
|
|
|
|
|
|
|
( subroutines => [ $parent->subroutines ] |
195
|
|
|
|
|
|
|
, manual => $parent->manual |
196
|
|
|
|
|
|
|
, output => \*OUT |
197
|
|
|
|
|
|
|
, @show |
198
|
|
|
|
|
|
|
); |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
close OUT; |
201
|
0
|
0
|
|
|
|
|
length $out or return; |
202
|
|
|
|
|
|
|
|
203
|
0
|
|
|
|
|
|
$out =~ s/\n*$/\n\n/; |
204
|
0
|
|
|
|
|
|
($out); |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub diagnostics($$$$$$) |
208
|
0
|
|
|
0
|
0
|
|
{ my ($self, $template, $tag, $attrs, $then, $else) = @_; |
209
|
0
|
|
|
|
|
|
my $manual = $template->valueFor('manual_obj'); |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
my $out = ''; |
212
|
0
|
|
|
|
|
|
open OUT, '>',\$out; |
213
|
0
|
|
|
|
|
|
$self->chapterDiagnostics(%$attrs, manual => $manual, output => \*OUT); |
214
|
0
|
|
|
|
|
|
close OUT; |
215
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
$out =~ s/\n*$/\n\n/; |
217
|
0
|
|
|
|
|
|
($out); |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
1; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
__DATA__ |