Branch Coverage

blib/lib/Perl/Tidy/HtmlWriter.pm
Criterion Covered Total %
branch 71 350 20.2


line true false branch
56 0 44 if (not eval {
57 0 0 $Perl::Tidy::HtmlWriter::EVAL_ERROR ? :
68 0 0 if $AUTOLOAD =~ /\bDESTROY$/
91 0 1 if (@arglist % 2)
115 0 1 unless ($html_fh)
121 0 1 if (not $input_file or $input_file eq "-" or ref $input_file)
131 0 1 if ($rOpts->{'html-pre-only'}) { }
148 1 0 if ($log_message and $logger_object)
156 1 0 if ($rOpts->{'pod2html'})
162 0 1 if ($rOpts->{'frames'})
163 0 0 if (not $extension) { }
183 1 0 unless ($title)
236 0 0 if (${$rin_toc_package;})
245 0 0 if (${$rin_toc_package;})
255 1 0 unless (${$rtoc_item_count;})
259 1 0 if $type eq "EOF"
271 0 0 if ($type eq "package")
275 0 0 if (my $count = $$rtoc_name_count{lc $unique_name}++)
281 0 0 if ($rOpts->{'pod2html'})
284 0 0 if ($type eq "sub")
286 0 0 unless ($package)
290 0 0 if (${$rin_toc_package;} and ${$rin_toc_package;} ne $package)
295 0 0 unless (${$rin_toc_package;})
301 0 0 if ($type eq 'package') { }
0 0 elsif ($type eq 'sub') { }
316 0 0 if ($type eq "EOF")
565 0 1 if (defined $rOpts->{'stylesheet'})
572 0 1 if (defined $rOpts->{'html-linked-style-sheet'})
574 0 0 if ($css_linkname =~ /^-/)
580 0 0 if ($css_linkname and $rOpts->{'nohtml-style-sheets'})
587 0 1 if ($css_linkname)
595 0 0 unless (-e $css_linkname)
601 1 0 if ($rOpts->{'pod2html'})
602 0 1 if ($rOpts->{'html-pre-only'}) { }
607 0 1 unless ($loaded_pod_formatter)
629 0 1 unless $rOpts->{'pod2html'}
640 0 1 if ($use_pod_formatter)
643 0 0 unless ($ok{$use_pod_formatter})
656 1 0 if ($formatter eq "Pod::Simple::XHTML")
657 0 1 if (not eval {
671 0 0 if ($formatter eq "Pod::Simple::HTML")
672 0 0 if (not eval {
686 0 0 if ($formatter eq "Pod::Html")
687 0 0 if (not eval {
703 0 1 unless ($loaded_pod_formatter)
716 0 0 unless ($fh)
720 0 0 if ($fh->can("close") and $filename ne "-" and not ref $filename)
721 0 0 unless $fh->close
738 1 0 unless $pre_bg_color
754 12 6 if (length $short_name == 1)
756 5 13 unless (defined $color)
759 4 14 if ($html_bold{$short_name})
763 2 16 if ($html_italic{$short_name})
775 0 14 if ($rOpts->{$key})
785 0 14 if ($color =~ /^[0-9a-fA-F]{6,6}$/)
795 0 12 defined $rOpts->{$key} ? :
797 0 12 defined $rOpts->{$key} ? :
814 1 0 unless ($pod_string)
819 0 0 if ($loaded_pod_formatter eq 'Pod::Simple::XHTML') { }
0 0 elsif ($loaded_pod_formatter eq 'Pod::Simple::HTML') { }
0 0 elsif ($loaded_pod_formatter eq 'Pod::Html') { }
835 0 0 unless ($rhtml_string)
848 0 0 unless $no_print
849 0 0 if ($in_toc)
859 0 0 if ($rOpts->{'timestamp'})
867 0 0 if ($is_encoded_data or $is_pure_ascii_data) { }
875 0 0 if ($line =~ /^\s*<html>\s*$/i) { }
0 0 elsif (not $saw_charset and $line =~ /^\s*<meta.*charset=([\w\-]+)/i) { }
0 0 elsif ($line =~ /^\s*<body.*>\s*$/i) { }
0 0 elsif ($line =~ /^\s*<!-- INDEX BEGIN -->\s*$/i) { }
0 0 elsif ($line =~ /^\s*<ul\s+id="index">/i) { }
0 0 elsif ($line =~ /^\s*<!-- INDEX END -->\s*$/i) { }
0 0 elsif ($line =~ /\s*<ul>\s*$/i and $in_toc and $in_toc eq 'UL') { }
0 0 elsif ($line =~ m[\s*</ul>]i and $in_toc and $in_toc eq 'UL') { }
0 0 elsif ($line =~ /^(.*)<!-- pERLTIDY sECTION -->(.*)$/) { }
0 0 elsif ($line =~ m[^\s*</body>]i) { }
883 0 0 if (uc $saw_charset ne uc $want_charset)
892 0 0 if $css_string
916 0 0 if $rOpts->{'frames'}
933 0 0 if $rOpts->{'frames'}
943 0 0 if ($toc_string)
944 0 0 if $rOpts->{'frames'}
965 0 0 if ($ul_level <= 0)
967 0 0 if ($toc_string)
968 0 0 if $rOpts->{'frames'}
982 0 0 if $1
985 0 0 if ($self->{'_pod_cut_count'} > 1) { }
987 0 0 if (${$rpre_string;}) { }
1009 0 0 unless $line =~ /^\s*<hr>\s*$/i
1016 0 0 if (@{$rpre_string_stack;})
1017 0 0 if ($self->{'_pod_cut_count'} <= 1)
1035 0 0 unless ($saw_body)
1039 0 0 unless ($saw_body_end)
1045 0 0 if (not $saw_index and defined $in_toc)
1050 0 0 if ($html_fh->can("close"))
1054 0 0 if ($success_flag and $rOpts->{'frames'})
1081 0 0 unless ($fh_tmp)
1087 0 0 if ($is_encoded_data) { }
1093 0 0 if ($pod_is_pure_ascii_data) { }
0 0 elsif ($is_encoded_data) { }
0 0 elsif (not $is_pure_ascii_data) { }
1110 0 0 unless ($fh_tmp->close)
1130 0 0 if ($rOpts->{$kw})
1140 0 0 if ($rOpts->{$kw}) { }
0 0 elsif (defined $rOpts->{$kw}) { }
1152 0 0 if ($rOpts->{$kw})
1157 0 0 if -e $tmpfile
1165 0 0 if (open my $fh, '<', $tmpfile) { }
1167 0 0 if ($is_encoded_data) { }
1171 0 0 unless $fh->close
1179 0 0 if (-e $tmpfile)
1180 0 0 unless (unlink $tmpfile)
1205 0 0 if $psx->can("index")
1210 0 0 unless ($is_pure_ascii_data)
1214 0 0 if ($psx->can('parse_characters')) { }
1220 0 0 if ($is_encoded_data) { }
1234 0 0 if ($pass_octets)
1280 0 0 unless rename $html_filename, $src_filename
1309 0 0 unless my $fh = "IO::File"->new($toc_filename, "w")
1345 0 0 unless my $fh = "IO::File"->new($frame_filename, "w")
1359 0 0 if ($top_basename) { }
1406 0 0 if ($line =~ /^(.*)<a(.*)href\s*=\s*"([^#]*)#([^"]+)"[^>]*>(.*)$/i)
1412 0 0 unless ($first_anchor)
1423 0 1 unless $self->{'_html_file_opened'}
1433 0 1 if ($rOpts->{'html-pre-only'})
1437 0 0 if $html_fh->can("close")
1450 0 1 if ($rOpts->{'pod2html'} and $self->{'_pod_cut_count'} >= 1 and $rOpts->{'html-color-background'} eq "#FFFFFF")
1462 0 1 if ($rOpts->{'html-linked-style-sheet'}) { }
0 1 elsif ($rOpts->{'nohtml-style-sheets'}) { }
1489 1 0 if ($rOpts->{'pod2html'})
1495 0 1 if $success
1504 0 1 if ($rOpts->{'timestamp'})
1518 1 0 if ($css_string) { }
1539 0 0 if (${$rtoc_string;} and not $rOpts->{'frames'} and $rOpts->{'html-table-of-contents'})
1565 0 1 if $html_fh->can("close")
1568 0 1 if ($rOpts->{'frames'})
1588 0 46 if $level < 0
1595 3 43 if ($level > ${$rlast_level;}) { }
3 40 elsif ($level < ${$rlast_level;}) { }
1596 1 2 unless ($$rpackage_stack[$level - 1])
1603 0 3 unless ($package)
1607 0 3 if ($package ne $$rpackage_stack[$level + 1])
1622 0 46 if ($type eq "S" and $token =~ /^(\w+\s+)(\w.*)$/)
1631 0 0 unless ($signature =~ /^i;/)
1644 0 46 if ($type eq "P" and $token =~ /^(\w+\s+)(\w.*)$/)
1667 21 25 if $type eq "b"
1668 0 25 if $token =~ /^\s*$/
1673 4 21 unless (defined $short_name)
1678 25 0 if (not $rOpts->{'nohtml-style-sheets'}) { }
1679 21 4 if ($short_name ne "pu")
1688 0 0 if ($color and $color ne $rOpts->{'html-color-punctuation'})
1691 0 0 if ($html_italic{$short_name})
1692 0 0 if ($html_bold{$short_name})
1700 0 26 if ($missing_html_entities or not $rOpts_html_entities) { }
1734 0 2 unless $self->{'_html_file_opened'}
1743 2 0 if ($line_type eq 'CODE') { }
1748 2 0 if ($input_line =~ /(^\s*)/) { }
1762 0 0 if ($line_type eq 'HERE') { }
0 0 elsif ($line_type eq 'HERE_END') { }
0 0 elsif ($line_type eq 'FORMAT') { }
0 0 elsif ($line_type eq 'FORMAT_END') { }
0 0 elsif ($line_type eq 'SKIP') { }
0 0 elsif ($line_type eq 'SKIP_END') { }
0 0 elsif ($line_type eq 'SYSTEM') { }
0 0 elsif ($line_type eq 'END_START') { }
0 0 elsif ($line_type eq 'DATA_START') { }
0 0 elsif ($line_type =~ /^POD/) { }
1782 0 0 if ($rOpts->{'pod2html'})
1784 0 0 if ($line_type eq "POD_START")
1792 0 0 if (${$rpre_string;} =~ /\S/) { }
1819 0 0 if ($line_type eq "POD_END")
1831 0 2 if ($rOpts->{'html-line-numbers'})
1832 0 0 $line_number < 1000 ? :
0 0 $line_number < 100 ? :
0 0 $line_number < 10 ? :