Branch Coverage

blib/lib/Text/Amuse/Output.pm
Criterion Covered Total %
branch 340 398 85.4


line true false branch
77 0 820 unless $opts{'document'}
79 0 820 unless $opts{'format'} and $opts{'format'} eq 'ltx' || $opts{'format'} eq 'html'
82 819 1 if (ref $self->{'document'} and $self->{'document'}->can("language_code"))
172 12778 21481 if ($el->type eq "null")
173 0 12778 if $el->anchors
176 4874 16607 if ($el->type eq 'startblock') { }
4874 11733 elsif ($el->type eq 'stopblock') { }
8482 3251 elsif ($el->type eq 'regular') { }
30 3221 elsif ($el->type eq 'standalone') { }
285 2936 elsif ($el->type eq 'dt') { }
1691 1245 elsif ($el->is_header) { }
296 949 elsif ($el->type eq 'verse') { }
138 811 elsif ($el->type eq 'inlinecomment') { }
70 741 elsif ($el->type eq 'comment') { }
220 521 elsif ($el->type eq 'table') { }
450 71 elsif ($el->type eq 'example') { }
71 0 elsif ($el->type eq 'newpage') { }
177 0 4874 if $el->string
185 0 4874 if $el->string
190 48 8434 if ($el->string =~ /\A\s*-----*\s*\z/s) { }
380 8054 elsif ($el->string =~ /\A\s*\[\[\s*$imagere\s*\] (\[[^\]\[]+?\])?\]\s*\z/sx and not $el->string =~ /\[\[.*\[\[/s) { }
213 755 787 if ($el->type =~ /h[1-4]/ and $split and @pieces)
215 547 208 if ($self->is_html)
222 0 547 if $self->flush_footnotes
223 0 547 if $self->flush_secondary_footnotes
255 662 362 if ($self->is_html)
262 0 662 if $self->flush_footnotes
263 0 662 if $self->flush_secondary_footnotes
266 324 700 if ($split)
306 0 658 unless defined $fn
307 530 128 if ($fn->type eq 'footnote') { }
128 0 elsif ($fn->type eq 'secondary_footnote') { }
320 229 301 unless (defined $self->{'_fn_list'})
328 57 71 unless (defined $self->{'_sec_fn_list'})
346 2189 229 unless defined $self->{'_fn_list'}
355 2361 57 unless defined $self->{'_sec_fn_list'}
365 0 658 unless $element
370 530 128 if ($element->type eq 'footnote') { }
128 0 elsif ($element->type eq 'secondary_footnote') { }
391 0 31026 unless $start_stop and $block
393 0 31026 unless $start_stop eq "stop" or $start_stop eq "start"
397 0 31026 unless exists $table->{$block}{$start_stop}{$self->fmt}
399 1535 29491 if (ref $string) { }
435 13 18202 unless length $string
437 90 18112 if ($string =~ m[\A\s*\
\s*\z])
480 5563 2860 if (length $text)
489 44 8379 if ($inlined_lang)
499 841 7582 if (delete $captures{'tag'}) { }
2085 5497 elsif (my $tag = delete $captures{'inline'}) { }
0 5497 elsif (delete $captures{'close_inline'}) { }
501 429 412 $close ? :
502 0 841 unless $args{'tag'} = delete $captures{'tag_name'}
510 0 0 unless $args{'tag'} = delete $captures{'close_inline_name'}
514 0 5497 if @rest
517 19 5478 if ($type eq "ruby")
521 0 8423 if %captures
524 4555 13557 @list ? :
532 0 18112 unless $string eq join("", map({$_->string;} @list))
533 32 18080 if (@list and $list[0] and $list[0]->type eq "br")
546 8256 9937 if (ref $el eq '') { }
551 919 9018 if ($el->type eq 'footnote') { }
230 8788 elsif ($el->type eq 'secondary_footnote') { }
559 0 18193 unless (defined $string)
576 90 31970 if ($piece->type eq 'bidimarker') { }
578 0 90 unless my $dir = $dirs{$piece->string}
580 38 52 if ($current_direction) { }
581 38 0 if ($dir ne $current_direction) { }
607 14 18179 if ($current_direction)
630 2077 29997 if ($el->type eq "inline")
631 1829 248 if ($i > 0 and $i < $#processed)
632 64 1765 if ($processed[$i - 1]->string =~ /[[:alnum:]]\z/ and $processed[$i + 1]->string =~ /\A[[:alnum:]]/)
648 2013 30061 if ($piece->type eq "inline")
649 1765 248 @pieces ? :
650 2013 0 @processed ? :
653 248 1765 if (not $previous) { }
0 1765 elsif (not $next) { }
654 167 81 if ($next and scalar grep({$_->tag eq $piece->tag;} @processed) and $next->string =~ /\A\S/)
666 0 0 if (@tracking and $piece->tag eq $tracking[-1] and $previous->string =~ /\S\z/)
681 736 1029 if (@tracking and $piece->tag eq $tracking[-1] and $previous->string =~ /\S\z/) { }
596 433 elsif ($next->string =~ /\A\S/ and $previous->string =~ /[[:^alnum:]]\z/ and scalar grep({$_->tag eq $piece->tag;} @processed)) { }
684 736 0 if ($previous->type ne "open_inline")
722 36 26 if ($type eq "close" or $type eq "close_inline")
734 763 31311 if ($piece->type eq 'open_inline') { }
736 30575 elsif ($piece->type eq 'close_inline') { }
736 1189 4901 if $_->type eq "close_inline"
750 13 if (grep {$_->tag eq $piece->tag if $_->type eq 'close_inline';} @pieces) { }
747 736 0 if (@tracking and $tracking[-1] eq $piece->tag) { }
767 1310 30968 if ($piece->type eq 'open') { }
1313 29655 elsif ($piece->type eq 'close') { }
769 3406 9359 if $_->type eq "close"
1297 13 if (grep {$_->tag eq $piece->tag if $_->type eq 'close';} @processed) { }
779 1277 36 if (@tagpile and $tagpile[-1] eq $piece->tag) { }
783 36 1241 if ($pieces[-1]->type eq "open" and $pieces[-1]->tag eq $piece->tag)
814 1774 30452 if ($piece->type eq 'link') { }
1264 29188 elsif ($piece->type eq 'pri_footnote') { }
312 28876 elsif ($piece->type eq 'sec_footnote') { }
815 120 1654 if ($opts{'nolinks'}) { }
824 919 345 if ($insert_primary_footnote and my $pri_fn = $self->document->get_footnote($piece->string)) { }
826 511 408 if ($self->is_html and $piece->string =~ /\A(\s+)/)
837 230 82 if ($insert_secondary_footnote and my $sec_fn = $self->document->get_footnote($piece->string)) { }
839 125 105 if ($self->is_html and $piece->string =~ /\A(\s+)/)
856 491 658 if ($self->is_latex) { }
658 0 elsif ($self->is_html) { }
869 102 389 if ($element->type eq 'secondary_footnote') { }
926 1653 38 unless (defined $long and length $long)
933 417 16 if ($self->document->get_footnote($fn)) { }
948 149 1542 if ($first_anchor and $first_anchor =~ /[A-Za-z0-9]/)
958 309 1382 $body ne $body_for_toc ? :
961 149 1542 if ($anchors)
962 88 61 if ($self->is_html) { }
61 0 elsif ($self->is_latex) { }
973 1542 149 if ($el->type =~ /h([1-4])/)
976 1542 0 defined $body_for_toc ? :
980 0 1542 unless $index
983 869 673 if ($self->is_html)
1002 0 1542 unless $level and defined $string
1003 311 1231 unless (defined $self->{'_toc_entries'})
1007 118 1424 $named ? :
1024 121 903 if defined $self->{'_toc_entries'}
1064 104 117 unless $internal_toc
1079 152 144 if ($self->is_html) { }
144 0 elsif ($self->is_latex) { }
1096 648 130 if ($l =~ /\A( *)(.+?)\z/s) { }
130 0 elsif ($l =~ /\A\s*\z/s) { }
1099 648 0 if (length $text)
1105 0 130 if @stanza
1112 278 18 if @stanza
1113 0 296 if @stanza
1124 209 199 if ($self->is_html) { }
199 0 elsif ($self->is_latex) { }
1133 396 12 if (@$stanza)
1153 69 69 if ($self->is_html) { }
69 0 elsif ($self->is_latex) { }
1179 114 106 if ($self->is_html) { }
106 0 elsif ($self->is_latex) { }
1198 33 81 if ($table->{'specification'})
1204 41 73 if ($table->{'caption'} ne "")
1211 134 208 unless @{$table->{$tablepart};}
1222 237 1145 if ($table->{'specification'})
1264 35 71 if (defined $table->{'caption'} and $table->{'caption'} ne "")
1268 35 71 if ($has_caption) { }
1277 33 73 if ($table->{'specification'}) { }
1286 73 33 unless ($table->{'specification'})
1289 53 53 if (my(@head) = @{$out->{'head'};})
1292 106 0 if (my(@body) = @{$out->{'body'};})
1295 29 77 if (my(@foot) = @{$out->{'foot'};})
1298 73 33 unless ($table->{'specification'})
1302 35 71 if ($has_caption)
1308 35 71 if ($has_caption) { }
1328 174 848 if ($c =~ /\A\s*\:?---+\:?\s*\z/) { }
36 812 elsif ($c =~ /\A\s*---+\s*([0-9]+)\s*---+\s*\z/) { }
1329 54 120 if ($c =~ /\:-+\:/) { }
18 102 elsif ($c =~ /\:-/) { }
18 84 elsif ($c =~ /-\:/) { }
1344 30 6 if ($percentage > 0 and $percentage < 100) { }
1358 66 812 if (@spec and @spec == @$cells) { }
1368 0 220 unless $table
1382 76 998 if ($r =~ /\A\s*\|\+\s*(.+?)\s*\+\|\s*\z/) { }
1396 70 928 if ($r =~ /\|\|\|/) { }
88 840 elsif ($r =~ /\|\|/) { }
1402 227 771 if ($cells[0] =~ /\A\s*\z/)
1412 69 151 if ($empty_first_cell == @row_cells)
1424 220 778 if ($output->{'counter'} < scalar @cells)
1427 878 120 unless ($output->{'specification'})
1429 66 812 if (my(@spec) = $self->_table_row_specification(\@cells))
1434 36 30 if ($i == 1)
1436 30 6 if (@{$output->{'body'};} == 1 and @{$output->{'head'};} == 0)
1457 66 154 if (my $spec = $output->{'specification'})
1484 0 48 if $el->string =~ /\w/s
1485 24 24 if ($self->is_html) { }
24 0 elsif ($self->is_latex) { }
1502 0 71 if $el->string =~ /\w/s
1503 39 32 if ($self->is_html) { }
32 0 elsif ($self->is_latex) { }
1529 0 1654 unless defined $link
1531 1168 486 if ($link =~ /\A\[\[ \s* (.+?) # link \s* \]\[ \s* (.+?) # desc \s* \]\]\z /sx) { }
486 0 elsif ($link =~ /\[\[ \s* (.+?) # link \s* \]\]/sx) { }
1565 100 1068 if (my $image = $self->find_image($link))
1572 826 242 if ($link =~ /\A\#([A-Za-z][A-Za-z0-9-]*)\z/)
1574 417 409 if ($self->is_html) { }
409 0 elsif ($self->is_latex) { }
1586 539 120 if ($self->is_html) { }
120 0 elsif ($self->is_latex) { }
1605 320 166 if (my $image = $self->find_image($link))
1609 16 150 if ($link =~ /\A\#([A-Za-z][A-Za-z0-9]+)\z/)
1612 10 6 if ($self->is_html) { }
6 0 elsif ($self->is_latex) { }
1623 78 72 if ($self->is_html) { }
72 0 elsif ($self->is_latex) { }
1659 742 30284 unless ($self->{'_block_table_map'})
2039 430 1236 if ($link =~ /\A$imagere\z/s) { }
2080 237 1145 if ($spec)
2086 117 120 if (my $align = $specs{$spec}) { }
15 105 elsif ($spec =~ /p\{0\.([0-9][0-9])\\textwidth/) { }
2138 251 148 if ($map{$type})
2143 99 300 if ($start and $start =~ /\A[0-9]+\z/ and $start > 1)
2163 96 282 if ($start and $start =~ /\A[0-9]+\z/ and $start > 1)
2173 120 614 if (defined $attributes{'toc_entry'}) { }
2192 609 21537 if (my(@anchors) = map({"Text::Amuse::InlineElement"->new("string", $_, "type", "anchor", "lang", $self->_lang, "fmt", $self->fmt)->stringify;} $el->anchors))