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