Branch Coverage

blib/lib/Perl/Tidy/HtmlWriter.pm
Criterion Covered Total %
branch 72 352 20.4


line true false branch
57 0 44 if (not eval {
58 0 0 $Perl::Tidy::HtmlWriter::EVAL_ERROR ? :
69 0 0 if $AUTOLOAD =~ /\bDESTROY$/
92 0 1 if (@arglist % 2)
116 0 1 unless ($html_fh)
122 0 1 if (not $input_file or $input_file eq "-" or ref $input_file)
132 0 1 if ($rOpts->{'html-pre-only'}) { }
149 1 0 if ($log_message and $logger_object)
157 1 0 if ($rOpts->{'pod2html'})
163 0 1 if ($rOpts->{'frames'})
164 0 0 if (not $extension) { }
184 1 0 unless ($title)
237 0 0 if (${$rin_toc_package;})
246 0 0 if (${$rin_toc_package;})
256 1 0 unless (${$rtoc_item_count;})
260 1 0 if $type eq "EOF"
272 0 0 if ($type eq "package")
276 0 0 if (my $count = $$rtoc_name_count{lc $unique_name}++)
282 0 0 if ($rOpts->{'pod2html'})
285 0 0 if ($type eq "sub")
287 0 0 unless ($package)
291 0 0 if (${$rin_toc_package;} and ${$rin_toc_package;} ne $package)
296 0 0 unless (${$rin_toc_package;})
302 0 0 if ($type eq 'package') { }
0 0 elsif ($type eq 'sub') { }
317 0 0 if ($type eq "EOF")
493 0 69430 if ($rexpansion->{$short_name})
587 0 1 if (defined $rOpts->{'stylesheet'})
594 0 1 if (defined $rOpts->{'html-linked-style-sheet'})
596 0 0 if ($css_linkname =~ /^-/)
602 0 0 if ($css_linkname and $rOpts->{'nohtml-style-sheets'})
609 0 1 if ($css_linkname)
617 0 0 unless (-e $css_linkname)
623 1 0 if ($rOpts->{'pod2html'})
624 0 1 if ($rOpts->{'html-pre-only'}) { }
629 0 1 unless ($loaded_pod_formatter)
651 0 1 unless $rOpts->{'pod2html'}
662 0 1 if ($use_pod_formatter)
665 0 0 unless ($ok{$use_pod_formatter})
678 1 0 if ($formatter eq "Pod::Simple::XHTML")
679 0 1 if (not eval {
693 0 0 if ($formatter eq "Pod::Simple::HTML")
694 0 0 if (not eval {
708 0 0 if ($formatter eq "Pod::Html")
709 0 0 if (not eval {
725 0 1 unless ($loaded_pod_formatter)
738 0 0 unless ($fh)
742 0 0 if ($fh->can("close") and $filename ne "-" and not ref $filename)
743 0 0 unless $fh->close
760 1 0 unless $pre_bg_color
776 12 6 if (length $short_name == 1)
778 5 13 unless (defined $color)
781 4 14 if ($html_bold{$short_name})
785 2 16 if ($html_italic{$short_name})
797 0 14 if ($rOpts->{$key})
807 0 14 if ($color =~ /^[0-9a-fA-F]{6,6}$/)
817 0 12 defined $rOpts->{$key} ? :
819 0 12 defined $rOpts->{$key} ? :
836 1 0 unless ($pod_string)
841 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') { }
857 0 0 unless ($rhtml_string)
870 0 0 unless $no_print
871 0 0 if ($in_toc)
881 0 0 if ($rOpts->{'timestamp'})
889 0 0 if ($is_encoded_data or $is_pure_ascii_data) { }
897 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) { }
905 0 0 if (uc $saw_charset ne uc $want_charset)
914 0 0 if $css_string
938 0 0 if $rOpts->{'frames'}
955 0 0 if $rOpts->{'frames'}
965 0 0 if ($toc_string)
966 0 0 if $rOpts->{'frames'}
987 0 0 if ($ul_level <= 0)
989 0 0 if ($toc_string)
990 0 0 if $rOpts->{'frames'}
1004 0 0 if $1
1007 0 0 if ($self->{'_pod_cut_count'} > 1) { }
1009 0 0 if (${$rpre_string;}) { }
1031 0 0 unless $line =~ /^\s*<hr>\s*$/i
1038 0 0 if (@{$rpre_string_stack;})
1039 0 0 if ($self->{'_pod_cut_count'} <= 1)
1057 0 0 unless ($saw_body)
1061 0 0 unless ($saw_body_end)
1067 0 0 if (not $saw_index and defined $in_toc)
1072 0 0 if ($html_fh->can("close"))
1076 0 0 if ($success_flag and $rOpts->{'frames'})
1103 0 0 unless ($fh_tmp)
1109 0 0 if ($is_encoded_data) { }
1115 0 0 if ($pod_is_pure_ascii_data) { }
0 0 elsif ($is_encoded_data) { }
0 0 elsif (not $is_pure_ascii_data) { }
1132 0 0 unless ($fh_tmp->close)
1152 0 0 if ($rOpts->{$kw})
1162 0 0 if ($rOpts->{$kw}) { }
0 0 elsif (defined $rOpts->{$kw}) { }
1174 0 0 if ($rOpts->{$kw})
1179 0 0 if -e $tmpfile
1187 0 0 if (open my $fh, '<', $tmpfile) { }
1189 0 0 if ($is_encoded_data) { }
1193 0 0 unless $fh->close
1201 0 0 if (-e $tmpfile)
1202 0 0 unless (unlink $tmpfile)
1227 0 0 if $psx->can("index")
1232 0 0 unless ($is_pure_ascii_data)
1236 0 0 if ($psx->can('parse_characters')) { }
1242 0 0 if ($is_encoded_data) { }
1256 0 0 if ($pass_octets)
1302 0 0 unless rename $html_filename, $src_filename
1331 0 0 unless my $fh = "IO::File"->new($toc_filename, "w")
1367 0 0 unless my $fh = "IO::File"->new($frame_filename, "w")
1381 0 0 if ($top_basename) { }
1428 0 0 if ($line =~ /^(.*)<a(.*)href\s*=\s*"([^#]*)#([^"]+)"[^>]*>(.*)$/i)
1434 0 0 unless ($first_anchor)
1445 0 1 unless $self->{'_html_file_opened'}
1455 0 1 if ($rOpts->{'html-pre-only'})
1459 0 0 if $html_fh->can("close")
1472 0 1 if ($rOpts->{'pod2html'} and $self->{'_pod_cut_count'} >= 1 and $rOpts->{'html-color-background'} eq "#FFFFFF")
1484 0 1 if ($rOpts->{'html-linked-style-sheet'}) { }
0 1 elsif ($rOpts->{'nohtml-style-sheets'}) { }
1511 1 0 if ($rOpts->{'pod2html'})
1517 0 1 if $success
1526 0 1 if ($rOpts->{'timestamp'})
1540 1 0 if ($css_string) { }
1561 0 0 if (${$rtoc_string;} and not $rOpts->{'frames'} and $rOpts->{'html-table-of-contents'})
1587 0 1 if $html_fh->can("close")
1590 0 1 if ($rOpts->{'frames'})
1610 0 46 if $level < 0
1617 3 43 if ($level > ${$rlast_level;}) { }
3 40 elsif ($level < ${$rlast_level;}) { }
1618 1 2 unless ($$rpackage_stack[$level - 1])
1625 0 3 unless ($package)
1629 0 3 if ($package ne $$rpackage_stack[$level + 1])
1644 0 46 if ($type eq "S" and $token =~ /^(\w+\s+)(\w.*)$/)
1653 0 0 unless ($signature =~ /^i;/)
1666 0 46 if ($type eq "P" and $token =~ /^(\w+\s+)(\w.*)$/)
1689 21 25 if $type eq "b"
1690 0 25 if $token =~ /^\s*$/
1695 4 21 unless (defined $short_name)
1700 25 0 if (not $rOpts->{'nohtml-style-sheets'}) { }
1701 21 4 if ($short_name ne "pu")
1710 0 0 if ($color and $color ne $rOpts->{'html-color-punctuation'})
1713 0 0 if ($html_italic{$short_name})
1714 0 0 if ($html_bold{$short_name})
1722 0 26 if ($missing_html_entities or not $rOpts_html_entities) { }
1756 0 2 unless $self->{'_html_file_opened'}
1765 2 0 if ($line_type eq 'CODE') { }
1770 2 0 if ($input_line =~ /(^\s*)/) { }
1784 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/) { }
1804 0 0 if ($rOpts->{'pod2html'})
1806 0 0 if ($line_type eq "POD_START")
1814 0 0 if (${$rpre_string;} =~ /\S/) { }
1841 0 0 if ($line_type eq "POD_END")
1855 0 2 if ($rOpts->{'html-line-numbers'})
1856 0 0 $line_number < 1000 ? :
0 0 $line_number < 100 ? :
0 0 $line_number < 10 ? :