Branch Coverage

blib/lib/Text/MediawikiFormat.pm
Criterion Covered Total %
branch 106 194 54.6


line true false branch
153 1 14 if @_ == 1
167 19 71 if (defined(my $val = delete $_[0]{$key}))
213 0 2890 if (not defined $obj) { }
231 2659 elsif (ref $obj eq 'HASH') { }
913 1746 elsif (ref $obj eq 'ARRAY') { }
226 1746 1144 if $type eq 'SCALAR'
227 913 231 if $type eq 'ARRAY'
240 0 169 unless UNIVERSAL::isa($left, 'HASH') and UNIVERSAL::isa($right, 'HASH')
245 235 8 if (exists $$right{$leftkey}) { }
253 2031 235 unless exists $$left{$rightkey}
264 0 371 unless defined $left
265 0 371 unless defined $right
271 169 202 if (ref $left eq 'HASH') { }
51 151 elsif (ref $left eq 'ARRAY') { }
281 169 202 if (ref $right eq 'HASH') { }
49 153 elsif (ref $right eq 'ARRAY') { }
295 0 1 if $Text::MediawikiFormat::missing_html_packages
300 3 15 unless @_ > 1
310 1 14 if $$iopts{'process_html'}
409 11 12 if ($_[2] eq ';') { }
410 6 5 if ($_[0] =~ /^(.*?)\s+:\s+(.*)$/) { }
423 11 12 if defined $term
424 18 5 if defined $def
447 0 28 unless $$opts{'charset'}
448 28 0 if $$opts{'charset'} =~ /^utf-?8$/i
458 7 25 if ($tag =~ /^\[\[([^|#]*)(?:(#)([^|]*))?(?:(\|)(.*))?\]\]$/) { }
5 20 elsif ($tag =~ /^\[(\S*)(?:(\s+)(.*))?\]$/) { }
461 7 0 if $1
462 0 7 if $2
464 3 4 if ($4) { }
467 3 0 if (length $5) { }
486 5 0 if ($2) { }
500 8 12 if ($tag =~ /^$s:[$Text::MediawikiFormat::uricCheat][$Text::MediawikiFormat::uric]*$/) { }
504 1 7 if $href =~ s/[$Text::MediawikiFormat::uriCruft]$//
526 3 9 if (@$toc and $level > $$toc[-1]{'level'}) { }
529 2 1 unless exists $$toc[-1]{'sublevel'}
561 0 50 if $$opts{'process_html'}
578 3 49 if keys %blocks
603 0 0 if (@$lines and not $$lines[-1][1] =~ /\n$/ and not $state ne $$lines[-1][0] && grep(/^nowiki$/, $state, $$lines[-1][0]))
611 0 0 if $state eq 'html'
615 0 0 if @$lines
618 0 0 if @$lines and $$lines[-1][1] =~ /\n$/
629 0 0 if $isEmptyTag
631 0 0 unless (grep /^\Q$tagname\E$/, @{$$tags{'allowed_tags'};})
639 0 0 @$tagstack ? :
642 0 0 if ($type eq 'E' and $stacktop eq $tagname)
649 0 0 if ($tagname eq 'nowiki') { }
663 0 0 if (@$tagstack and grep /^\Q$stacktop\E$/, ('nowiki', 'pre'))
670 0 0 if ($type eq 'E' and $HTML::Tagset::isPhraseMarkup{$tagname})
681 0 0 if ($type eq 'E')
693 0 0 if ($tagname eq 'nowiki')
694 0 0 unless $isEmptyTag
702 0 0 if (defined $$attr{$_})
704 0 0 unless ($$attr{$_} eq '__TEXT_MEDIAWIKIFORMAT_BOOL__')
712 0 0 if $HTML::Tagset::emptyElement{$tagname} or $isEmptyTag
716 0 0 if ($HTML::Tagset::isPhraseMarkup{$tagname} or $HTML::Tagset::emptyElement{$tagname})
724 0 0 if (@$tagstack)
725 0 0 if ($tagname eq $stacktop and $HTML::Tagset::optionalEndTag{$tagname}) { }
0 0 elsif (not $HTML::Tagset::is_Possible_Strict_P_Content{$tagname}) { }
735 0 0 if grep /^\Q$checking\E$/, @HTML::Tagset::p_closure_barriers
737 0 0 if ($checking eq 'p')
751 0 0 unless $isEmptyTag
754 0 0 $tagname eq 'pre' ? :
769 0 0 if $skipped_text
772 0 0 if (@$tagstack)
773 0 0 if (grep /\Q$$tagstack[-1]\E/, ('nowiki', 'pre')) { }
0 0 elsif ($is_cdata and $HTML::Tagset::isCDATA_Parent{$$tagstack[-1]}) { }
784 0 0 unless (defined $newtext)
785 0 0 unless defined $newtext
817 0 0 if $i == $#lines
828 0 0 if ($type) { }
835 0 0 if $block
846 0 50 if ($$opts{'process_html'}) { }
853 298 2 if $block
863 87 218 unless $text
864 0 218 if $type
875 443 773 if $$tags{'indented'}{$block}
880 1000 216 unless $marker_removed
895 1 53 unless @$blocks
911 117 88 unless $block->type eq 'end'
923 135 0 if ($$tags{$type}) { }
931 5 130 grep(/^\Q$type\E$/, @{$$tags{'unformatted_blocks'};}) ? :
937 18 222 if (blessed $line)
944 32 190 if ((ref $start_line || '') eq 'CODE') { }
953 55 80 if $between
960 205 238 unless $text =~ s/($$tags{'indent'})//
984 1 0 if $$opts{'extended'} or $$opts{'absolute_links'} or $$opts{'implicit_links'}
996 4 7 if $start_pos == -1
999 0 7 if $end_pos == -1
1018 225 2 if ($$opts{'absolute_links'})
1027 17 210 if ($$opts{'implicit_links'})
1030 17 0 if ($$tags{'implicit_link_delimiters'}) { }
1038 226 1 if ($$opts{'extended'})
1041 3 223 if (not $$tags{'extended_link_delimiters'}) { }
4 219 elsif (ref $$tags{'extended_link_delimiters'} eq 'ARRAY') { }
1051 21 0 defined $_ ? :
1061 227 0 if (@res)