lib/OODoc/Format/Html.pm

filter: Statementstmt 8.7% 43 / 494 Branchbran 0.0% 0 / 280 Conditioncond 0.0% 0 / 78 MC/DCmcdc 0.0% 0 / 47 Subroutinesub 20.6% 13 / 63 Podpod 78.9% 30 / 38 totaltotal 8.6% 86 / 1000 SCAR 103.0
CC
186
Cov
5%
templateList
1260.0
templateIndex
870.0
createOtherPages
156.0
CRAP 29803.8
↑ Summary lib/OODoc/Parser/Markov.pm »
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 package OODoc::Format::Html;
9 1 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 $VERSION = '2.02';
11  
12 1 ▶use base 'OODoc::Format';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use OODoc::Template ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use IO::File ();
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use File::Find qw/find/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use File::Basename qw/basename dirname/;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use File::Copy qw/copy/;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use POSIX qw/strftime/;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use List::Util qw/first/;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28  
29 sub init($)
30 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
31 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
32  
33 0 ▶ my $html = delete $args->{html_root} || '/';
Condition0%0/2
delete $args->{'html_root'} || '/'
l!l
00
MC/DC0%0/1
delete $args->{'html_root'} || '/'
delete $args->{'html_root'}
Truth table0%0/2
A
A= delete $args->{'html_root'}
Aresult
11
00
34 0 $html =~ s! /$ !!x;
35  
36 0 $self->{OFH_html} = $html;
37 0 ▶ $self->{OFH_jump} = delete $args->{jump_script} || "$html/jump.cgi";
Condition0%0/2
delete $args->{'jump_script'} || "$html/jump.cgi"
l!l
00
MC/DC0%0/1
delete $args->{'jump_script'} || "$html/jump.cgi"
delete $args->{'jump_script'}
Truth table0%0/2
A
A= delete $args->{'jump_script'}
Aresult
11
00
38  
39 0 ▶ my $meta = delete $args->{html_meta_data} || '';
Condition0%0/2
delete $args->{'html_meta_data'} || ''
l!l
00
MC/DC0%0/1
delete $args->{'html_meta_data'} || ''
delete $args->{'html_meta_data'}
Truth table0%0/2
A
A= delete $args->{'html_meta_data'}
Aresult
11
00
40 0 ▶ if(my $ss = $self->{OFH_style} = delete $args->{html_stylesheet})
Branch: 1 branch
BranchTrueFalseTotal
if (my $ss = $self->{"OFH_style"} = delete $args->{"html_stylesheet"}) 0 0 0
41 0 { my $base = basename $ss;
42 0 $meta .= qq[<link rel="STYLESHEET" href="/$base">];
43 }
44 0 $self->{OFH_meta} = $meta;
45 0 $self;
46 }
47  
48 #-------------------------------------------
49  
50  
51 0 ▶sub manual(;$) {my $s = shift; @_ ? $s->{OFH_manual}=shift : $s->{OFH_manual}}
Subroutine manual: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
52  
53 #-------------------------------------------
54  
55  
56 sub cleanupString($$)
57 0 ▶{ my $self = shift;
Subroutine cleanupString: not called CC=1 SCAR=6.9
Pod documented
58 0 my $text = $self->cleanup(@_);
59 0 $text =~ s!</p>\s*<p>!<br>!gs;
60 0 $text =~ s!\</?p\>!!g;
61 0 $text;
62 }
63  
64  
65 sub link($$;$)
66 0 ▶{ my ($self, $manual, $object, $text) = @_;
Subroutine link: not called CC=3 SCAR=24.8
Pod documented
67 0 ▶ $text = $object->name unless defined $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text 0 0 0
68  
69 0 my $jump;
70 0 ▶ if($object->isa('OODoc::Manual'))
Branch: 1 branch
BranchTrueFalseTotal
if ($object->isa('OODoc::Manual')) { } 0 0 0
71 0 { (my $manname = $object->name) =~ s!\:\:!_!g;
72 0 $jump = "$self->{OFH_html}/$manname/index.html";
73 }
74 else
75 0 { (my $manname = $manual->name) =~ s!\:\:!_!g;
76 0 $jump = $self->{OFH_jump}.'?'.$manname.'&'.$object->unique;
77 }
78  
79 0 qq[<a href="$jump" target="_top">$text</a>];
80 }
81  
82  
83 sub mark($$)
84 0 ▶{ my ($self, $manual, $id) = @_;
Subroutine mark: not called CC=1 SCAR=6.9
Pod documented
85 0 $manual =~ s/\:\:/_/g;
86 0 $self->{OFH_markers}->print("$id $manual $self->{OFH_filename}\n");
87 }
88  
89  
90 sub createManual($@)
91 0 ▶{ my ($self, %args) = @_;
Subroutine createManual: not called CC=10 SCAR=47.0
Pod documented
92 0 ▶ my $verbose = $args{verbose} || 0;
Condition0%0/2
$args{'verbose'} || 0
l!l
00
MC/DC0%0/1
$args{'verbose'} || 0
$args{'verbose'}
Truth table0%0/2
A
A= $args{'verbose'}
Aresult
11
00
93 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
94 0 ▶ my $options = $args{format_options} || [];
Condition0%0/2
$args{'format_options'} || []
l!l
00
MC/DC0%0/1
$args{'format_options'} || []
$args{'format_options'}
Truth table0%0/2
A
A= $args{'format_options'}
Aresult
11
00
95  
96 # Location for the manual page files.
97  
98 0 ▶ my $template = $args{template} || File::Spec->catdir('html', 'manual');
Condition0%0/3
$args{'template'} || 'File::Spec'->catdir('html', 'manual')
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'template'} || 'File::Spec'->catdir('html', 'manual')
$args{'template'} 'File::Spec'->catdir('html', 'manual')
Truth table0%0/3
A || B
A= $args{'template'}B= 'File::Spec'->catdir('html', 'manual')
ABresult
1X1
011
000
99 0 my %template = $self->expandTemplate($template, $options);
100  
101 0 (my $manfile = "$manual") =~ s!\:\:!_!g;
102 0 my $dest = File::Spec->catdir($self->workdir, $manfile);
103 0 $self->mkdirhier($dest);
104  
105 # File to trace markers must be open.
106  
107 0 ▶ unless(defined $self->{OFH_markers})
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"OFH_markers"}) 0 0 0
108 0 { my $markers = File::Spec->catdir($self->workdir, 'markers');
109 0 ▶ my $mark = IO::File->new($markers, 'w')
Branch: 1 branch
BranchTrueFalseTotal
my $mark = "IO::File"->new($markers, "w") or &fault(&__x("cannot write markers to {fn}", "fn", $markers)) 0 0 0
110 or fault __x"cannot write markers to {fn}", fn => $markers;
111 0 $self->{OFH_markers} = $mark;
112 0 $mark->print($self->{OFH_html}, "\n");
113 }
114  
115 #
116 # Process template
117 #
118  
119 0 my $manifest = $self->manifest;
120 0 ▶ while(my($raw, $options) = each %template)
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %template) 0 0 0
121 0 { my $cooked = File::Spec->catfile($dest, basename $raw);
122  
123 0 ▶ print "$manual: $cooked\n" if $verbose > 2;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose > 2 0 0 0
124 0 $manifest->add($cooked);
125  
126 0 ▶ my $output = IO::File->new($cooked, 'w')
Branch: 1 branch
BranchTrueFalseTotal
my $output = "IO::File"->new($cooked, "w") or &fault(&__x("cannot write html manual to {fn}", "fn", $cooked)) 0 0 0
127 or fault __x"cannot write html manual to {fn}", fn => $cooked;
128  
129 0 $self->{OFH_filename} = basename $raw;
130  
131 0 $self->manual($manual);
132 0 $self->format
133 ( output => $output
134 , template_fn => $raw
135 , @$options
136 );
137 0 $self->manual(undef);
138 0 $output->close;
139 }
140  
141 0 delete $self->{OFH_filename};
142 0 $self;
143 }
144  
145  
146 sub createOtherPages(@)
147 0 ▶{ my ($self, %args) = @_;
Subroutine createOtherPages: not called CC=12 SCAR=50.5
Pod documented
148  
149 0 ▶ my $verbose = $args{verbose} || 0;
Condition0%0/2
$args{'verbose'} || 0
l!l
00
MC/DC0%0/1
$args{'verbose'} || 0
$args{'verbose'}
Truth table0%0/2
A
A= $args{'verbose'}
Aresult
11
00
150  
151 #
152 # Collect files to be processed
153 #
154  
155 0 my $source = $args{source};
156 0 ▶ if(defined $source)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $source) { } 0 0 0
157 0 ▶ { -d $source
Branch: 1 branch
BranchTrueFalseTotal
-d $source or &fault(&__x("html source directory {dir}", "dir", $source)) 0 0 0
158 or fault __x"html source directory {dir}", dir => $source;
159 }
160 else
161 0 { $source = File::Spec->catdir("html", "other");
162 0 ▶ -d $source or return $self;
Branch: 1 branch
BranchTrueFalseTotal
-d $source or return $self 0 0 0
163 }
164  
165 0 ▶ my $process = $args{process} || qr/\.(s?html|cgi)$/;
Condition0%0/3
$args{'process'} || qr/\.(s?html|cgi)$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{'process'} || qr/\.(s?html|cgi)$/
$args{'process'} qr/\.(s?html|cgi)$/
Truth table0%0/3
A || B
A= $args{'process'}B= qr/\.(s?html|cgi)$/
ABresult
1X1
011
000
166  
167 0 my $dest = $self->workdir;
168 0 $self->mkdirhier($dest);
169  
170 0 my @sources;
171 find( { no_chdir => 1
172 0 ▶ , wanted => sub { my $fn = $File::Find::name;
Subroutine __ANON__: not called CC=2 SCAR=17.9
173 0 ▶ push @sources, $fn if -f $fn;
Branch: 1 branch
BranchTrueFalseTotal
if -f $fn 0 0 0
174 }
175 0 }, $source
176 );
177  
178 #
179 # Process files, one after the other
180 #
181  
182 0 my $manifest = $self->manifest;
183 0 foreach my $raw (@sources)
184 0 { (my $cooked = $raw) =~ s/\Q$source\E/$dest/;
185  
186 0 ▶ print "create $cooked\n" if $verbose > 2;
Branch: 1 branch
BranchTrueFalseTotal
if $verbose > 2 0 0 0
187 0 $manifest->add($cooked);
188  
189 0 ▶ if($raw =~ $process)
Branch: 1 branch
BranchTrueFalseTotal
if ($raw =~ /$process/) { } 0 0 0
190 0 { $self->mkdirhier(dirname $cooked);
191 0 ▶ my $output = IO::File->new($cooked, 'w')
Branch: 1 branch
BranchTrueFalseTotal
my $output = "IO::File"->new($cooked, "w") or &fault(&__x("cannot write html to {fn}", "fn", $cooked)) 0 0 0
192 or fault __x"cannot write html to {fn}", fn => $cooked;
193  
194 0 my $options = [];
195 0 $self->format
196 ( manual => undef
197 , output => $output
198 , template_fn => $raw
199 , @$options
200 );
201 0 $output->close;
202 }
203 else
204 0 ▶ { copy($raw, $cooked)
Branch: 1 branch
BranchTrueFalseTotal
copy($raw, $cooked) or &fault(&__x("copy from {from} to {to} failed", "from", $raw, "to", $cooked)) 0 0 0
205 or fault __x"copy from {from} to {to} failed"
206 , from => $raw, to => $cooked;
207 }
208  
209 0 my $rawmode = (stat $raw)[2] & 07777;
210 0 ▶ chmod $rawmode, $cooked
Branch: 1 branch
BranchTrueFalseTotal
chmod $rawmode, $cooked or &fault(&__x("chmod of {fn} to {mode%o} failed", "fn", $cooked, "mode", $rawmode)) 0 0 0
211 or fault __x"chmod of {fn} to {mode%o} failed"
212 , fn => $cooked, mode => $rawmode;
213 }
214  
215 0 $self;
216 }
217  
218  
219 sub expandTemplate($$)
220 0 ▶{ my $self = shift;
Subroutine expandTemplate: not called CC=7 SCAR=40.3
Pod documented
221 0 ▶ my $loc = shift || panic;
Condition0%0/3
shift() || &panic()
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || &panic()
shift() &panic()
Truth table0%0/3
A || B
A= shift()B= &panic()
ABresult
1X1
011
000
222 0 ▶ my $defaults = shift || [];
Condition0%0/2
shift() || []
l!l
00
MC/DC0%0/1
shift() || []
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
223  
224 0 my @result;
225 0 ▶ if(ref $loc eq 'HASH')
Branch: 3 branches
BranchTrueFalseTotal
if (ref $loc eq 'HASH') { } 0 0 0
elsif (-d $loc) { } 0 0 0
elsif (-f $loc) { } 0 0 0
226 0 { foreach my $n (keys %$loc)
227 0 { my %options = (@$defaults, @{$loc->{$n}});
228 0 push @result, $self->expandTemplate($n, [ %options ])
229 }
230 }
231 elsif(-d $loc)
232 { find( { no_chdir => 1,
233 0 ▶ wanted => sub { my $fn = $File::Find::name;
Subroutine __ANON__: not called CC=2 SCAR=17.9
234 0 ▶ push @result, $fn, $defaults
Branch: 1 branch
BranchTrueFalseTotal
if -f $fn 0 0 0
235 if -f $fn;
236 }
237 0 }, $loc
238 );
239 }
240 0 elsif(-f $loc) { push @result, $loc => $defaults }
241 0 else { error __x"cannot find template source '{name}'", name => $loc }
242  
243 0 @result;
244 }
245  
246 sub showStructureExpand(@)
247 0 ▶{ my ($self, %args) = @_;
Subroutine showStructureExpand: not called CC=9 SCAR=45.0
Pod undocumented
248  
249 0 ▶ my $examples = $args{show_chapter_examples} || 'EXPAND';
Condition0%0/2
$args{'show_chapter_examples'} || 'EXPAND'
l!l
00
MC/DC0%0/1
$args{'show_chapter_examples'} || 'EXPAND'
$args{'show_chapter_examples'}
Truth table0%0/2
A
A= $args{'show_chapter_examples'}
Aresult
11
00
250 0 ▶ my $text = $args{structure} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $text = $args{"structure"} or &panic() 0 0 0
251  
252 0 my $name = $text->name;
253 0 my $level = $text->level +1; # header level, chapter = H2
254 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
255 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
256  
257 # Produce own chapter description
258  
259 0 my $descr = $self->cleanup($manual, $text->description);
260 0 my $unique = $text->unique;
261 0 (my $id = $name) =~ s/\W+/_/g;
262  
263 0 $output->print(
264 qq[\n<h$level id="$id"><a name="$unique">$name</a></h$level>\n$descr]
265 );
266  
267 0 $self->mark($manual, $unique);
268  
269 # Link to inherited documentation.
270  
271 0 my $super = $text;
272 0 ▶ while($super = $super->extends)
Branch: 1 branch
BranchTrueFalseTotal
if ($super = $super->extends) 0 0 0
273 0 ▶ { last if $super->description !~ m/^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $super->description =~ /^\s*$/ 0 0 0
274 }
275  
276 0 ▶ if(defined $super)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $super) 0 0 0
277 0 { my $superman = $super->manual; # :-)
278 0 $output->print( "<p>See ", $self->link($superman, $super), " in "
279 , $self->link(undef, $superman), "</p>\n");
280 }
281  
282 # Show the subroutines and examples.
283  
284 0 $self->showSubroutines(%args, subroutines => [$text->subroutines]);
285 0 ▶ $self->showExamples(%args, examples => [$text->examples])
Branch: 1 branch
BranchTrueFalseTotal
if $examples eq "EXPAND" 0 0 0
286 if $examples eq 'EXPAND';
287  
288 0 $self;
289 }
290  
291 sub showStructureRefer(@)
292 0 ▶{ my ($self, %args) = @_;
Subroutine showStructureRefer: not called CC=4 SCAR=30.0
Pod documented
293  
294 0 ▶ my $text = $args{structure} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $text = $args{"structure"} or &panic() 0 0 0
295 0 my $name = $text->name;
296 0 my $level = $text->level;
297  
298 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
299 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
300  
301 0 my $link = $self->link($manual, $text);
302 0 $output->print(
303 qq[\n<h$level id="$name"><a href="$link">$name</a><h$level>\n]);
304 0 $self;
305 }
306  
307 sub chapterDiagnostics(@)
308 0 ▶{ my ($self, %args) = @_;
Subroutine chapterDiagnostics: not called CC=6 SCAR=37.4
Pod undocumented
309  
310 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
311 0 my $diags = $manual->chapter('DIAGNOSTICS');
312  
313 0 my @diags = map {$_->diagnostics} $manual->subroutines;
314 0 ▶ $diags = OODoc::Text::Chapter->new(name => 'DIAGNOSTICS')
Branch: 1 branch
BranchTrueFalseTotal
if not $diags and @diags 0 0 0
Condition0%0/3
not $diags and @diags
!ll&&!rl&&r
000
MC/DC0%0/2
not $diags and @diags
not $diags @diags
Truth table0%0/3
not(A) and B
A= not $diagsB= @diags
ABresult
0X0
100
111
315 if !$diags && @diags;
316  
317 0 ▶ return unless $diags;
Branch: 1 branch
BranchTrueFalseTotal
unless $diags 0 0 0
318  
319 0 ▶ $self->showChapter(chapter => $diags, %args)
Branch: 1 branch
BranchTrueFalseTotal
if defined $diags 0 0 0
320 if defined $diags;
321  
322 0 $self->showDiagnostics(%args, diagnostics => \@diags);
323 0 $self;
324 }
325  
326 sub showExamples(@)
327 0 ▶{ my ($self, %args) = @_;
Subroutine showExamples: not called CC=6 SCAR=37.4
Pod documented
328 0 ▶ my $examples = $args{examples} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $examples = $args{"examples"} or &panic() 0 0 0
329 0 ▶ return unless @$examples;
Branch: 1 branch
BranchTrueFalseTotal
unless @$examples 0 0 0
330  
331 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
332 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
333  
334 0 $output->print( qq[<dl class="example">\n] );
335  
336 0 foreach my $example (@$examples)
337 0 { my $name = $example->name;
338 0 my $descr = $self->cleanup($manual, $example->description);
339 0 my $unique = $example->unique;
340 0 $output->print( <<EXAMPLE );
341 <dt>&raquo;&nbsp;<a name="$unique">Example</a>: $name</dt>
342 <dd>$descr</dd>
343 EXAMPLE
344  
345 0 $self->mark($manual, $unique);
346 }
347 0 $output->print( qq[</dl>\n] );
348  
349 0 $self;
350 }
351  
352 sub showDiagnostics(@)
353 0 ▶{ my ($self, %args) = @_;
Subroutine showDiagnostics: not called CC=6 SCAR=37.4
Pod undocumented
354 0 ▶ my $diagnostics = $args{diagnostics} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $diagnostics = $args{"diagnostics"} or &panic() 0 0 0
355 0 ▶ return unless @$diagnostics;
Branch: 1 branch
BranchTrueFalseTotal
unless @$diagnostics 0 0 0
356  
357 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
358 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
359  
360 0 $output->print( qq[<dl class="diagnostics">\n] );
361  
362 0 foreach my $diag (sort @$diagnostics)
363 0 { my $name = $diag->name;
364 0 my $type = $diag->type;
365 0 my $text = $self->cleanup($manual, $diag->description);
366 0 my $unique = $diag->unique;
367  
368 0 $output->print( <<DIAG );
369 <dt class="type">&raquo;&nbsp;$type: <a name="$unique">$name</a></dt>
370 <dd>$text</dd>
371 DIAG
372  
373 0 $self->mark($manual, $unique);
374 }
375  
376 0 $output->print( qq[</dl>\n] );
377 0 $self;
378 }
379  
380 sub showSubroutine(@)
381 0 ▶{ my $self = shift;
Subroutine showSubroutine: not called CC=3 SCAR=24.8
Pod documented
382 0 my %args = @_;
383 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
384 0 ▶ my $sub = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $sub = $args{"subroutine"} or &panic() 0 0 0
385 0 my $type = $sub->type;
386 0 my $name = $sub->name;
387  
388 0 $self->SUPER::showSubroutine(@_);
389  
390 0 $output->print( qq[</dd>\n</dl>\n</div>\n] );
391 0 $self;
392 }
393  
394 sub showSubroutineUse(@)
395 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutineUse: not called CC=12 SCAR=50.5
Pod documented
396 0 ▶ my $subroutine = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $subroutine = $args{"subroutine"} or &panic() 0 0 0
397 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
398 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
399  
400 0 my $type = $subroutine->type;
401 0 my $name = $self->cleanupString($manual, $subroutine->name);
402 0 my $paramlist = $self->cleanupString($manual, $subroutine->parameters);
403 0 my $unique = $subroutine->unique;
404  
405 0 my $class = $manual->package;
406  
407 0 my $call = qq[<b><a name="$unique">$name</a></b>];
408 0 ▶ $call .= "(&nbsp;$paramlist&nbsp;)" if length $paramlist;
Branch: 1 branch
BranchTrueFalseTotal
if length $paramlist 0 0 0
409 0 $self->mark($manual, $unique);
410  
411 0 ▶ my $use
Branch: 6 branches
BranchTrueFalseTotal
$type eq 'i_method' ? : 0 0 0
$type eq 'c_method' ? : 0 0 0
$type eq 'ci_method' ? : 0 0 0
$type eq 'overload' ? : 0 0 0
$type eq 'function' ? : 0 0 0
$type eq 'tie' ? : 0 0 0
412 = $type eq 'i_method' ? qq[\$obj-&gt;$call]
413 : $type eq 'c_method' ? qq[\$class-&gt;$call]
414 : $type eq 'ci_method'? qq[\$obj-&gt;$call<br>\$class-&gt;$call]
415 : $type eq 'overload' ? qq[overload: $call]
416 : $type eq 'function' ? qq[$call]
417 : $type eq 'tie' ? $call
418 : warning("unknown subroutine type {type} for {name} in {manual}"
419 , type => $type, name => $name, manual => $manual);
420  
421 0 $output->print( <<SUBROUTINE );
422 <div class="$type" id="$name">
423 <dl>
424 <dt class="sub_use">$use</dt>
425 <dd class="sub_body">
426 SUBROUTINE
427  
428 0 ▶ if($manual->inherited($subroutine))
Branch: 1 branch
BranchTrueFalseTotal
if ($manual->inherited($subroutine)) 0 0 0
429 0 { my $defd = $subroutine->manual;
430 0 my $sublink = $self->link($defd, $subroutine, $name);
431 0 my $manlink = $self->link($manual, $defd);
432 0 $output->print( qq[See $sublink in $manlink.<br>\n] );
433 }
434 0 $self;
435 }
436  
437 sub showSubsIndex(@)
438 0 ▶{ my ($self, %args) = @_;
Subroutine showSubsIndex: not called CC=2 SCAR=17.9
Pod undocumented
439 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
440 }
441  
442 sub showSubroutineName(@)
443 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutineName: not called CC=6 SCAR=37.4
Pod documented
444 0 ▶ my $subroutine = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $subroutine = $args{"subroutine"} or &panic() 0 0 0
445 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
446 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
447 0 my $name = $subroutine->name;
448  
449 0 ▶ my $url
Branch: 1 branch
BranchTrueFalseTotal
$manual->inherited($subroutine) ? : 0 0 0
450 = $manual->inherited($subroutine)
451 ? "M<".$subroutine->manual."::$name>"
452 : "M<$name>";
453  
454 $output->print
455 ( $self->cleanupString($manual, $url)
456 0 ▶ , ($args{last} ? ".\n" : ",\n")
Branch: 1 branch
BranchTrueFalseTotal
$args{'last'} ? : 0 0 0
457 );
458 }
459  
460 sub showOptions(@)
461 0 ▶{ my $self = shift;
Subroutine showOptions: not called CC=2 SCAR=17.9
Pod documented
462 0 my %args = @_;
463 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
464 0 $output->print( qq[<dl class="options">\n] );
465  
466 0 $self->SUPER::showOptions(@_);
467  
468 0 $output->print( qq[</dl>\n] );
469 0 $self;
470 }
471  
472 sub showOptionUse(@)
473 0 ▶{ my ($self, %args) = @_;
Subroutine showOptionUse: not called CC=5 SCAR=34.0
Pod documented
474 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
475 0 ▶ my $option = $args{option} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $option = $args{"option"} or &panic() 0 0 0
476 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
477  
478 0 my $params = $self->cleanupString($manual, $option->parameters);
479 0 $params =~ s/\s+$//;
480 0 $params =~ s/^\s+//;
481 0 ▶ $params = qq[ =&gt; <span class="params">$params</span>]
Branch: 1 branch
BranchTrueFalseTotal
if length $params 0 0 0
482 if length $params;
483  
484 0 my $use = qq[<span class="option">$option</span>];
485 0 $output->print( qq[<dt class="option_use">$use$params</dt>\n] );
486 0 $self;
487 }
488  
489 sub showOptionExpand(@)
490 0 ▶{ my ($self, %args) = @_;
Subroutine showOptionExpand: not called CC=6 SCAR=37.4
Pod documented
491 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
492 0 ▶ my $option = $args{option} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $option = $args{"option"} or &panic() 0 0 0
493 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
494  
495 0 $self->showOptionUse(%args);
496  
497 0 ▶ my $where = $option->findDescriptionObject or return $self;
Branch: 1 branch
BranchTrueFalseTotal
my $where = $option->findDescriptionObject or return $self 0 0 0
498 0 my $descr = $self->cleanupString($manual, $where->description);
499  
500 0 ▶ $output->print( qq[<dd>$descr</dd>\n] )
Branch: 1 branch
BranchTrueFalseTotal
if length $descr 0 0 0
501 if length $descr;
502  
503 0 $self;
504 }
505  
506  
507 sub writeTable($@)
508 0 ▶{ my ($self, %args) = @_;
Subroutine writeTable: not called CC=6 SCAR=37.4
Pod documented
509  
510 0 ▶ my $rows = $args{rows} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $rows = $args{"rows"} or &panic() 0 0 0
511 0 ▶ return unless @$rows;
Branch: 1 branch
BranchTrueFalseTotal
unless @$rows 0 0 0
512  
513 0 ▶ my $head = $args{header} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $head = $args{"header"} or &panic() 0 0 0
514 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
515  
516 0 $output->print( qq[<table cellspacing="0" cellpadding="2" border="1">\n] );
517  
518 0 local $" = qq[</th> <th align="left">];
519 0 $output->print( qq[<tr><th align="left">@$head</th></tr>\n] );
520  
521 0 local $" = qq[</td> <td valign="top">];
522 $output->print( qq[<tr><td align="left">@$_</td></tr>\n] )
523 0 foreach @$rows;
524  
525 0 $output->print( qq[</table>\n] );
526 0 $self;
527 }
528  
529 sub showSubroutineDescription(@)
530 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutineDescription: not called CC=7 SCAR=40.3
Pod documented
531 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
532 0 ▶ my $subroutine = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $subroutine = $args{"subroutine"} or &panic() 0 0 0
533  
534 0 my $text = $self->cleanup($manual, $subroutine->description);
535 0 ▶ return $self unless length $text;
Branch: 1 branch
BranchTrueFalseTotal
unless length $text 0 0 0
536  
537 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
538 0 $output->print($text);
539  
540 0 ▶ my $extends = $self->extends or return $self;
Branch: 1 branch
BranchTrueFalseTotal
my $extends = $self->extends or return $self 0 0 0
541 0 ▶ my $refer = $extends->findDescriptionObject or return $self;
Branch: 1 branch
BranchTrueFalseTotal
my $refer = $extends->findDescriptionObject or return $self 0 0 0
542  
543 0 $output->print("<br>\n");
544 0 $self->showSubroutineDescriptionRefer(%args, subroutine => $refer);
545 }
546  
547 sub showSubroutineDescriptionRefer(@)
548 0 ▶{ my ($self, %args) = @_;
Subroutine showSubroutineDescriptionRefer: not called CC=4 SCAR=30.0
Pod undocumented
549 0 ▶ my $manual = $args{manual} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $args{"manual"} or &panic() 0 0 0
550 0 ▶ my $subroutine = $args{subroutine} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $subroutine = $args{"subroutine"} or &panic() 0 0 0
551 0 ▶ my $output = $args{output} or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $output = $args{"output"} or &panic() 0 0 0
552 0 $output->print("\nSee ", $self->link($manual, $subroutine), "\n");
553 }
554  
555 #----------------------
556  
557  
558 1 our %producers =
559 ( a => 'templateHref'
560 , chapter => 'templateChapter'
561 , date => 'templateDate'
562 , index => 'templateIndex'
563 , inheritance => 'templateInheritance'
564 , list => 'templateList'
565 , manual => 'templateManual'
566 , meta => 'templateMeta'
567 , distribution=> 'templateDistribution'
568 , name => 'templateName'
569 , project => 'templateProject'
570 , title => 'templateTitle'
571 , version => 'templateVersion'
572 );
573  
574 sub format(@)
575 0 ▶{ my ($self, %args) = @_;
Subroutine format: not called CC=2 SCAR=17.9
Pod documented
576 0 my $output = delete $args{output};
577  
578 0 my %permitted = %args;
579 0 my $template = OODoc::Template->new;
580 0 ▶ while(my ($tag, $method) = each %producers)
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %OODoc::Format::Html::producers) 0 0 0
581 { $permitted{$tag} = sub
582 { # my ($istag, $attrs, $ifblock, $elseblock) = @_;
583 0 ▶ shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
584 0 $self->$method($template, @_)
585 0 };
586 }
587  
588 $output->print(
589 0 scalar $template->processFile($args{template_fn}, \%permitted));
590 }
591  
592  
593 sub templateProject($$)
594 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateProject: not called CC=1 SCAR=6.9
Pod undocumented
595 0 $self->project;
596 }
597  
598  
599 sub templateTitle($$)
600 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateTitle: not called CC=2 SCAR=17.9
Pod documented
601  
602 0 ▶ my $manual = $self->manual
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $self->manual or &error(&__x("not a manual, so no automatic title in {fn}", "fn", scalar $templ->valueFor("template_fn"))) 0 0 0
603 or error __x"not a manual, so no automatic title in {fn}"
604 , fn => scalar $templ->valueFor('template_fn');
605  
606 0 my $name = $self->cleanupString($manual, $manual->name);
607 0 $name =~ s/\<[^>]*\>//g;
608 0 $name;
609 }
610  
611  
612 sub templateManual($$)
613 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateManual: not called CC=2 SCAR=17.9
Pod documented
614  
615 0 ▶ my $manual = $self->manual
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $self->manual or &error(&__x("not a manual, so no manual name for {fn}", "fn", scalar $templ->valueFor("template_fn"))) 0 0 0
616 or error __x"not a manual, so no manual name for {fn}"
617 , fn => scalar $templ->valueFor('template_fn');
618  
619 0 $self->cleanupString($manual, $manual->name);
620 }
621  
622  
623 sub templateDistribution($$)
624 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateDistribution: not called CC=2 SCAR=17.9
Pod documented
625 0 my $manual = $self->manual;
626 0 ▶ defined $manual ? $manual->distribution : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $manual ? : 0 0 0
627 }
628  
629  
630 sub templateVersion($$)
631 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateVersion: not called CC=2 SCAR=17.9
Pod documented
632 0 my $manual = $self->manual;
633 0 ▶ defined $manual ? $manual->version : $self->version;
Branch: 1 branch
BranchTrueFalseTotal
defined $manual ? : 0 0 0
634 }
635  
636  
637 sub templateDate($$)
638 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateDate: not called CC=1 SCAR=6.9
Pod documented
639 0 strftime "%Y/%m/%d", localtime;
640 }
641  
642  
643 sub templateName($$)
644 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateName: not called CC=4 SCAR=30.0
Pod documented
645  
646 0 ▶ my $manual = $self->manual
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $self->manual or &error(&__x("not a manual, so no name for {fn}", "fn", scalar $templ->valueFor("template_fn"))) 0 0 0
647 or error __x"not a manual, so no name for {fn}"
648 , fn => scalar $templ->valueFor('template_fn');
649  
650 0 ▶ my $chapter = $manual->chapter('NAME')
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter("NAME") or &error(&__x("cannot find chapter NAME in manual {fn}", $manual->source)) 0 0 0
651 or error __x"cannot find chapter NAME in manual {fn}", $manual->source;
652  
653 0 my $descr = $chapter->description;
654  
655 0 ▶ return $1 if $descr =~ m/^ \s*\S+\s*\-\s*(.*?)\s* $ /x;
Branch: 1 branch
BranchTrueFalseTotal
if $descr =~ /^ \s*\S+\s*\-\s*(.*?)\s* $ /x 0 0 0
656  
657 0 error __x"chapter NAME in manual {manual} has illegal shape"
658 , manual => $manual;
659 }
660  
661  
662 1 our %path_lookup =
663 ( front => "/index.html"
664 , manuals => "/manuals/index.html"
665 , methods => "/methods/index.html"
666 , diagnostics => "/diagnostics/index.html"
667 , details => "/details/index.html"
668 );
669  
670 sub templateHref($$)
671 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateHref: not called CC=4 SCAR=30.0
Pod documented
672 0 ▶ my $window = delete $attrs->{window} || '_top';
Condition0%0/2
delete $attrs->{'window'} || '_top'
l!l
00
MC/DC0%0/1
delete $attrs->{'window'} || '_top'
delete $attrs->{'window'}
Truth table0%0/2
A
A= delete $attrs->{'window'}
Aresult
11
00
673 0 ▶ keys %$attrs==1
Branch: 1 branch
BranchTrueFalseTotal
keys %$attrs == 1 or &error(&__x("expect one name with 'a'")) 0 0 0
674 or error __x"expect one name with 'a'";
675 0 (my $to) = keys %$attrs;
676  
677 0 ▶ my $path = $path_lookup{$to}
Branch: 1 branch
BranchTrueFalseTotal
my $path = $OODoc::Format::Html::path_lookup{$to} or &error(&__x("missing path for {dest}", "dest", $to)) 0 0 0
678 or error __x"missing path for {dest}", dest => $to;
679  
680 0 qq[<a href="$self->{OFH_html}$path" target="$window">];
681 }
682  
683  
684 sub templateMeta($$)
685 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateMeta: not called CC=1 SCAR=6.9
Pod documented
686 0 $self->{OFH_meta};
687 }
688  
689  
690 sub templateInheritance(@)
691 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateInheritance: not called CC=3 SCAR=24.8
Pod documented
692  
693 0 my $manual = $self->manual;
694 0 ▶ my $chapter = $manual->chapter('INHERITANCE')
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter("INHERITANCE") or return "" 0 0 0
695 or return '';
696  
697 0 my $buffer = '';
698 0 open my $out, '>', \$buffer;
699 0 $self->showChapter
700 ( %$attrs
701 , manual => $self->manual
702 , chapter => $chapter
703 , output => $out
704 );
705 0 close $out;
706  
707 0 for($buffer)
708 0 { s#\<pre\>\s*(.*?)\</pre\>\n*#\n$1#gs; # over-eager cleanup
709 0 s#^( +)#'&nbsp;' x length($1)#gme;
710 0 s# $ #<br>#gmx;
711 0 s#(\</h\d\>)(\<br\>\n?)+#$1\n#;
712 }
713  
714 0 $buffer;
715 }
716  
717  
718 sub templateChapter($$)
719 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateChapter: not called CC=6 SCAR=37.4
Pod documented
720 0 ▶ warning __x"no meaning for container {c} in chapter block", c => $if
Branch: 1 branch
BranchTrueFalseTotal
if defined $if and length $if 0 0 0
Condition0%0/3
defined $if and length $if
!ll&&!rl&&r
000
MC/DC0%0/2
defined $if and length $if
defined $if length $if
Truth table0%0/3
A and B
A= defined $ifB= length $if
ABresult
0X0
100
111
721 if defined $if && length $if;
722  
723 0 ▶ my $name = first { !/[a-z]/ } keys %$attrs;
Subroutine __ANON__: not called CC=1 SCAR=6.9
724 0 ▶ defined $name
Branch: 1 branch
BranchTrueFalseTotal
defined $name or &error(&__x("chapter without name in template {fn}", "fn", scalar $templ->valueFor("template_fn"))) 0 0 0
725 or error __x"chapter without name in template {fn}"
726 , fn => scalar $templ->valueFor('template_fn');
727  
728 0 my $manual = $self->manual;
729 0 ▶ defined $manual or panic;
Branch: 1 branch
BranchTrueFalseTotal
defined $manual or &panic() 0 0 0
730 0 ▶ my $chapter = $manual->chapter($name) or return '';
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter($name) or return "" 0 0 0
731  
732 0 my $buffer = '';
733 0 open my $out, '>', \$buffer;
734 0 $self->showChapter
735 ( %$attrs
736 , manual => $self->manual
737 , chapter => $chapter
738 , output => $out
739 );
740 0 close $out;
741  
742 0 $buffer;
743 }
744  
745  
746 sub templateIndex($$)
747 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateIndex: not called CC=29 SCAR=67.7
Pod documented
748  
749 0 ▶ warning __x"no meaning for container {c} in list block", c => $if
Branch: 1 branch
BranchTrueFalseTotal
if defined $if and length $if 0 0 0
Condition0%0/3
defined $if and length $if
!ll&&!rl&&r
000
MC/DC0%0/2
defined $if and length $if
defined $if length $if
Truth table0%0/3
A and B
A= defined $ifB= length $if
ABresult
0X0
100
111
750 if defined $if && length $if;
751  
752 0 ▶ my $group = first { !/[a-z]/ } keys %$attrs;
Subroutine __ANON__: not called CC=1 SCAR=6.9
753 0 ▶ defined $group
Branch: 1 branch
BranchTrueFalseTotal
defined $group or &error(&__x("no group named as attribute for list")) 0 0 0
754 or error __x"no group named as attribute for list";
755  
756 0 ▶ my $start = $attrs->{starting_with} || 'ALL';
Condition0%0/2
$attrs->{'starting_with'} || 'ALL'
l!l
00
MC/DC0%0/1
$attrs->{'starting_with'} || 'ALL'
$attrs->{'starting_with'}
Truth table0%0/2
A
A= $attrs->{'starting_with'}
Aresult
11
00
757 0 ▶ my $types = $attrs->{type} || 'ALL';
Condition0%0/2
$attrs->{'type'} || 'ALL'
l!l
00
MC/DC0%0/1
$attrs->{'type'} || 'ALL'
$attrs->{'type'}
Truth table0%0/2
A
A= $attrs->{'type'}
Aresult
11
00
758  
759 0 ▶ my $select = sub { @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
760 0 ▶ unless($start eq 'ALL')
Branch: 1 branch
BranchTrueFalseTotal
unless ($start eq "ALL") 0 0 0
761 0 { $start =~ s/_/[\\W_]/g;
762 0 my $regexp = qr/^$start/i;
763 0 ▶ $select = sub { grep $_->name =~ $regexp, @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
764 }
765 0 ▶ unless($types eq 'ALL')
Branch: 1 branch
BranchTrueFalseTotal
unless ($types eq "ALL") 0 0 0
766 0 ▶ { my @take = map { $_ eq 'method' ? '.*method' : $_ }
Branch: 1 branch
BranchTrueFalseTotal
$_ eq 'method' ? : 0 0 0
767 split /[_|]/, $types;
768 0 local $" = ')|(';
769 0 my $regexp = qr/^(@take)$/i;
770 0 my $before = $select;
771 0 ▶ $select = sub { grep $_->type =~ $regexp, $before->(@_) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
772 }
773  
774 0 ▶ my $columns = $attrs->{table_columns} || 2;
Condition0%0/2
$attrs->{'table_columns'} || 2
l!l
00
MC/DC0%0/1
$attrs->{'table_columns'} || 2
$attrs->{'table_columns'}
Truth table0%0/2
A
A= $attrs->{'table_columns'}
Aresult
11
00
775 0 my @rows;
776  
777 0 ▶ if($group eq 'SUBROUTINES')
Branch: 4 branches
BranchTrueFalseTotal
if ($group eq 'SUBROUTINES') { } 0 0 0
elsif ($group eq 'DIAGNOSTICS') { } 0 0 0
elsif ($group eq 'DETAILS') { } 0 0 0
elsif ($group eq 'MANUALS') { } 0 0 0
778 0 { my @subs;
779  
780 0 foreach my $manual ($self->manuals)
781 0 { foreach my $sub ($select->($manual->ownSubroutines))
782 0 { my $linksub = $self->link($manual, $sub, $sub->name);
783 0 my $linkman = $self->link(undef, $manual, $manual->name);
784 0 my $link = "$linksub -- $linkman";
785 0 push @subs, [ lc("$sub-$manual"), $link ];
786 }
787 }
788  
789 0 @rows = map { $_->[1] }
790 0 sort { $a->[0] cmp $b->[0] } @subs;
791 }
792 elsif($group eq 'DIAGNOSTICS')
793 0 { foreach my $manual ($self->manuals)
794 0 { foreach my $sub ($manual->ownSubroutines)
795 0 ▶ { my @diags = $select->($sub->diagnostics) or next;
Branch: 1 branch
BranchTrueFalseTotal
my(@diags) = &$select($sub->diagnostics) or next 0 0 0
796  
797 0 my $linksub = $self->link($manual, $sub, $sub->name);
798 0 my $linkman = $self->link(undef, $manual, $manual->name);
799  
800 0 foreach my $diag (@diags)
801 0 { my $type = uc($diag->type);
802 0 push @rows, <<"DIAG";
803 $type: $diag<br>
804 &middot;&nbsp;$linksub in $linkman<br>
805 DIAG
806 }
807 }
808 }
809  
810 0 @rows = sort @rows;
811 }
812 elsif($group eq 'DETAILS')
813 0 { foreach my $manual (sort $select->($self->manuals))
814 0 ▶ { my $details = $manual->chapter("DETAILS") or next;
Branch: 1 branch
BranchTrueFalseTotal
my $details = $manual->chapter("DETAILS") or next 0 0 0
815 0 my @sections;
816 0 foreach my $section ($details->sections)
817 0 ▶ { my @subsect = grep !$manual->inherited($_) && $_->description
Condition0%0/3
!$manual->inherited($_) && $_->description
!ll&&!rl&&r
000
MC/DC0%0/2
!$manual->inherited($_) && $_->description
!$manual->inherited($_) $_->description
Truth table0%0/3
not(A) && B
A= !$manual->inherited($_)B= $_->description
ABresult
0X0
100
111
818 , $section->subsections;
819 0 ▶ push @sections, $section
Branch: 1 branch
BranchTrueFalseTotal
if @subsect or $section->description 0 0 0
Condition0%0/3
@subsect or $section->description
l!l&&r!l&&!r
000
MC/DC0%0/2
@subsect or $section->description
@subsect $section->description
Truth table0%0/3
A or B
A= @subsectB= $section->description
ABresult
1X1
011
000
820 if @subsect || $section->description;
821 }
822  
823 0 ▶ @sections || length $details->description
Branch: 1 branch
BranchTrueFalseTotal
@sections or length $details->description or next 0 0 0
Condition0%0/3
@sections or length $details->description
l!l&&r!l&&!r
000
MC/DC0%0/2
@sections or length $details->description
@sections length $details->description
Truth table0%0/3
A or B
A= @sectionsB= length $details->description
ABresult
1X1
011
000
824 or next;
825  
826 my $sections = join "\n"
827 0 , map { "<li>".$self->link($manual, $_)."</li>" }
828 @sections;
829  
830 0 push @rows, $self->link($manual, $details, "Details in $manual")
831 . qq[\n<ul>\n$sections</ul>\n]
832 }
833 }
834 elsif($group eq 'MANUALS')
835 0 { @rows = map $self->link(undef, $_, $_->name)
836 , sort $select->($self->manuals);
837 }
838 else
839 0 { error __x"unknown group {name} as list attribute", name => $group;
840 }
841  
842 0 push @rows, ('') x ($columns-1);
843 0 my $rows = int(@rows/$columns);
844  
845 0 my $output = qq[<tr>];
846 0 ▶ while(@rows >= $columns)
Branch: 1 branch
BranchTrueFalseTotal
if (@rows >= $columns) 0 0 0
847 0 { $output .= qq[<td valign="top">]
848 . join( "<br>\n", splice(@rows, 0, $rows))
849 . qq[</td>\n];
850 }
851 0 $output .= qq[</tr>\n];
852 0 $output;
853 }
854  
855  
856 sub templateList($$)
857 0 ▶{ my ($self, $templ, $attrs, $if, $else) = @_;
Subroutine templateList: not called CC=35 SCAR=71.4
Pod documented
858 0 ▶ warning __x"no meaning for container {c} in index block", c => $if
Branch: 1 branch
BranchTrueFalseTotal
if defined $if and length $if 0 0 0
Condition0%0/3
defined $if and length $if
!ll&&!rl&&r
000
MC/DC0%0/2
defined $if and length $if
defined $if length $if
Truth table0%0/3
A and B
A= defined $ifB= length $if
ABresult
0X0
100
111
859 if defined $if && length $if;
860  
861 0 ▶ my $group = first { !/[a-z]/ } keys %$attrs;
Subroutine __ANON__: not called CC=1 SCAR=6.9
862 0 ▶ defined $group
Branch: 1 branch
BranchTrueFalseTotal
defined $group or &error(&__x("no group named as attribute for list")) 0 0 0
863 or error __x"no group named as attribute for list";
864  
865 0 ▶ my $show_sub = $attrs->{show_subroutines} || 'LIST';
Condition0%0/2
$attrs->{'show_subroutines'} || 'LIST'
l!l
00
MC/DC0%0/1
$attrs->{'show_subroutines'} || 'LIST'
$attrs->{'show_subroutines'}
Truth table0%0/2
A
A= $attrs->{'show_subroutines'}
Aresult
11
00
866 0 ▶ my $types = $attrs->{subroutine_types} || 'ALL';
Condition0%0/2
$attrs->{'subroutine_types'} || 'ALL'
l!l
00
MC/DC0%0/1
$attrs->{'subroutine_types'} || 'ALL'
$attrs->{'subroutine_types'}
Truth table0%0/2
A
A= $attrs->{'subroutine_types'}
Aresult
11
00
867 0 ▶ my $manual = $self->manual or panic;
Branch: 1 branch
BranchTrueFalseTotal
my $manual = $self->manual or &panic() 0 0 0
868 0 my $output = '';
869  
870 0 ▶ my $selected = sub { @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
871 0 ▶ unless($types eq 'ALL')
Branch: 1 branch
BranchTrueFalseTotal
unless ($types eq "ALL") 0 0 0
872 0 ▶ { my @take = map { $_ eq 'method' ? '.*method' : $_ }
Branch: 1 branch
BranchTrueFalseTotal
$_ eq 'method' ? : 0 0 0
873 split /[_|]/, $types;
874 0 local $" = ')|(?:';
875 0 my $regexp = qr/^(?:@take)$/;
876 0 ▶ $selected = sub { grep $_->type =~ $regexp, @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
877 }
878  
879 0 ▶ my $sorted = sub { sort {$a->name cmp $b->name} @_ };
Subroutine __ANON__: not called CC=1 SCAR=6.9
880  
881 0 ▶ if($group eq 'ALL')
Branch: 1 branch
BranchTrueFalseTotal
if ($group eq 'ALL') { } 0 0 0
882 0 { my @subs = $sorted->($selected->($manual->subroutines));
883 0 ▶ if(!@subs || $show_sub eq 'NO') { ; }
Branch: 2 branches
BranchTrueFalseTotal
if (not @subs or $show_sub eq 'NO') { } 0 0 0
elsif ($show_sub eq 'COUNT') { } 0 0 0
Condition0%0/3
not @subs or $show_sub eq "NO"
l!l&&r!l&&!r
000
MC/DC0%0/2
not @subs or $show_sub eq "NO"
not @subs $show_sub eq "NO"
Truth table0%0/3
not(A) or B
A= not @subsB= $show_sub eq "NO"
ABresult
1X1
011
000
884 0 elsif($show_sub eq 'COUNT') { $output .= @subs }
885 else
886 0 { $output .= $self->indexListSubroutines($manual,@subs);
887 }
888 }
889 else # any chapter
890 0 ▶ { my $chapter = $manual->chapter($group) or return '';
Branch: 1 branch
BranchTrueFalseTotal
my $chapter = $manual->chapter($group) or return "" 0 0 0
891 0 ▶ my $show_sec = $attrs->{show_sections} || 'LINK';
Condition0%0/2
$attrs->{'show_sections'} || 'LINK'
l!l
00
MC/DC0%0/1
$attrs->{'show_sections'} || 'LINK'
$attrs->{'show_sections'}
Truth table0%0/2
A
A= $attrs->{'show_sections'}
Aresult
11
00
892 0 ▶ my @sections = $show_sec eq 'NO' ? () : $chapter->sections;
Branch: 1 branch
BranchTrueFalseTotal
$show_sec eq 'NO' ? : 0 0 0
893  
894 0 ▶ my @subs = $sorted->($selected->( @sections
Branch: 1 branch
BranchTrueFalseTotal
@sections ? : 0 0 0
895 ? $chapter->subroutines
896 : $chapter->all('subroutines')
897 )
898 );
899  
900 0 $output .= $self->link($manual, $chapter, $chapter->niceName);
901 0 ▶ my $count = @subs && $show_sub eq 'COUNT' ? ' ('.@subs.')' : '';
Branch: 1 branch
BranchTrueFalseTotal
@subs && $show_sub eq 'COUNT' ? : 0 0 0
Condition0%0/3
@subs and $show_sub eq "COUNT"
!ll&&!rl&&r
000
MC/DC0%0/2
@subs and $show_sub eq "COUNT"
@subs $show_sub eq "COUNT"
Truth table0%0/3
A and B
A= @subsB= $show_sub eq "COUNT"
ABresult
0X0
100
111
902  
903 0 ▶ if($show_sec eq 'NO') { $output .= qq[$count<br>\n] }
Branch: 2 branches
BranchTrueFalseTotal
if ($show_sec eq 'NO') { } 0 0 0
elsif ($show_sec eq 'LINK' or $show_sec eq 'NAME') { } 0 0 0
904 ▶ elsif($show_sec eq 'LINK' || $show_sec eq 'NAME')
Condition0%0/3
$show_sec eq "LINK" or $show_sec eq "NAME"
l!l&&r!l&&!r
000
MC/DC0%0/2
$show_sec eq "LINK" or $show_sec eq "NAME"
$show_sec eq "LINK" $show_sec eq "NAME"
Truth table0%0/3
A or B
A= $show_sec eq "LINK"B= $show_sec eq "NAME"
ABresult
1X1
011
000
905 0 { $output .= qq[<br>\n<ul>\n];
906 0 ▶ if(!@subs) {;}
Branch: 3 branches
BranchTrueFalseTotal
if (not @subs) { } 0 0 0
elsif ($show_sec eq 'LINK') { } 0 0 0
elsif ($show_sec eq 'NAME') { } 0 0 0
907 elsif($show_sec eq 'LINK')
908 0 { my $link = $self->link($manual, $chapter, 'unsorted');
909 0 $output .= qq[<li>$link$count\n];
910 }
911 elsif($show_sec eq 'NAME')
912 0 { $output .= qq[<li>];
913 }
914  
915 0 ▶ $output .= $self->indexListSubroutines($manual,@subs)
Branch: 1 branch
BranchTrueFalseTotal
if @subs and $show_sub eq "LIST" 0 0 0
Condition0%0/3
@subs and $show_sub eq "LIST"
!ll&&!rl&&r
000
MC/DC0%0/2
@subs and $show_sub eq "LIST"
@subs $show_sub eq "LIST"
Truth table0%0/3
A and B
A= @subsB= $show_sub eq "LIST"
ABresult
0X0
100
111
916 if @subs && $show_sub eq 'LIST';
917 }
918 else
919 0 { error __x"illegal value to show_sections: {v}", v => $show_sec;
920 }
921  
922 # All sections within the chapter (if show_sec is enabled)
923  
924 0 foreach my $section (@sections)
925 0 { my @subs = $sorted->($selected->($section->all('subroutines')));
926  
927 0 ▶ my $count = ! @subs ? ''
Branch: 2 branches
BranchTrueFalseTotal
!@subs ? : 0 0 0
$show_sub eq 'COUNT' ? : 0 0 0
928 : $show_sub eq 'COUNT' ? ' ('.@subs.')'
929 : ': ';
930  
931 0 ▶ if($show_sec eq 'LINK')
Branch: 1 branch
BranchTrueFalseTotal
if ($show_sec eq 'LINK') { } 0 0 0
932 0 { my $link = $self->link($manual, $section, $section->niceName);
933 0 $output .= qq[<li>$link$count\n];
934 }
935 else
936 0 { $output .= qq[<li>$section$count\n];
937 }
938  
939 0 ▶ $output .= $self->indexListSubroutines($manual,@subs)
Branch: 1 branch
BranchTrueFalseTotal
if $show_sub eq "LIST" and @subs 0 0 0
Condition0%0/3
$show_sub eq "LIST" and @subs
!ll&&!rl&&r
000
MC/DC0%0/2
$show_sub eq "LIST" and @subs
$show_sub eq "LIST" @subs
Truth table0%0/3
A and B
A= $show_sub eq "LIST"B= @subs
ABresult
0X0
100
111
940 if $show_sub eq 'LIST' && @subs;
941  
942 0 $output .= qq[</li>\n];
943 }
944  
945 0 ▶ $output .= qq[</ul>\n]
Branch: 1 branch
BranchTrueFalseTotal
if $show_sec eq "LINK" or $show_sec eq "NAME" 0 0 0
Condition0%0/3
$show_sec eq "LINK" or $show_sec eq "NAME"
l!l&&r!l&&!r
000
MC/DC0%0/2
$show_sec eq "LINK" or $show_sec eq "NAME"
$show_sec eq "LINK" $show_sec eq "NAME"
Truth table0%0/3
A or B
A= $show_sec eq "LINK"B= $show_sec eq "NAME"
ABresult
1X1
011
000
946 if $show_sec eq 'LINK' || $show_sec eq 'NAME';
947 }
948  
949 0 $output;
950 }
951  
952 sub indexListSubroutines(@)
953 0 ▶{ my $self = shift;
Subroutine indexListSubroutines: not called CC=1 SCAR=6.9
Pod undocumented
954 0 my $manual = shift;
955  
956 join ",\n"
957 0 , map { $self->link($manual, $_, $_) }
958 @_;
959 }
960  
961 #-------------------------------------------
962  
963  
964 1 1;
↑ Summary lib/OODoc/Parser/Markov.pm »