lib/OODoc/Format/Html.pm

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