Branch Coverage

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


line true false branch
77 0 829 unless $opts{'document'}
79 0 829 unless $opts{'format'} and $opts{'format'} eq 'ltx' || $opts{'format'} eq 'html'
82 828 1 if (ref $self->{'document'} and $self->{'document'}->can("language_code"))
172 12902 21664 if ($el->type eq "null")
173 0 12902 if $el->anchors
176 4922 16742 if ($el->type eq 'startblock') { }
4922 11820 elsif ($el->type eq 'stopblock') { }
8532 3288 elsif ($el->type eq 'regular') { }
29 3259 elsif ($el->type eq 'standalone') { }
291 2968 elsif ($el->type eq 'dt') { }
1707 1261 elsif ($el->is_header) { }
302 959 elsif ($el->type eq 'verse') { }
140 819 elsif ($el->type eq 'inlinecomment') { }
70 749 elsif ($el->type eq 'comment') { }
224 525 elsif ($el->type eq 'table') { }
454 71 elsif ($el->type eq 'example') { }
71 0 elsif ($el->type eq 'newpage') { }
177 0 4922 if $el->string
185 0 4922 if $el->string
190 48 8484 if ($el->string =~ /\A\s*-----*\s*\z/s) { }
380 8104 elsif ($el->string =~ /\A\s*\[\[\s*$imagere\s*\] (\[[^\]\[]+?\])?\]\s*\z/sx and not $el->string =~ /\[\[.*\[\[/s) { }
213 755 801 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 666 367 if ($self->is_html)
262 0 666 if $self->flush_footnotes
263 0 666 if $self->flush_secondary_footnotes
266 324 709 if ($split)
306 0 677 unless defined $fn
307 543 134 if ($fn->type eq 'footnote') { }
134 0 elsif ($fn->type eq 'secondary_footnote') { }
320 234 309 unless (defined $self->{'_fn_list'})
328 58 76 unless (defined $self->{'_sec_fn_list'})
346 2192 234 unless defined $self->{'_fn_list'}
355 2368 58 unless defined $self->{'_sec_fn_list'}
365 0 677 unless $element
370 543 134 if ($element->type eq 'footnote') { }
134 0 elsif ($element->type eq 'secondary_footnote') { }
391 0 31274 unless $start_stop and $block
393 0 31274 unless $start_stop eq "stop" or $start_stop eq "start"
397 0 31274 unless exists $table->{$block}{$start_stop}{$self->fmt}
399 1553 29721 if (ref $string) { }
435 13 18337 unless length $string
437 96 18241 if ($string =~ m[\A\s*\
\s*\z])
480 5679 2893 if (length $text)
489 44 8528 if ($inlined_lang)
499 841 7731 if (delete $captures{'tag'}) { }
2089 5642 elsif (my $tag = delete $captures{'inline'}) { }
0 5642 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 5642 if @rest
517 18 5624 if ($type eq "ruby")
521 0 8572 if %captures
524 4628 13613 @list ? :
532 0 18241 unless $string eq join("", map({$_->string;} @list))
533 32 18209 if (@list and $list[0] and $list[0]->type eq "br")
546 8298 10030 if (ref $el eq '') { }
551 945 9085 if ($el->type eq 'footnote') { }
242 8843 elsif ($el->type eq 'secondary_footnote') { }
559 0 18328 unless (defined $string)
576 90 32370 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 18314 if ($current_direction)
630 2081 30393 if ($el->type eq "inline")
631 1833 248 if ($i > 0 and $i < $#processed)
632 64 1769 if ($processed[$i - 1]->string =~ /[[:alnum:]]\z/ and $processed[$i + 1]->string =~ /\A[[:alnum:]]/)
648 2017 30457 if ($piece->type eq "inline")
649 1769 248 @pieces ? :
650 2017 0 @processed ? :
653 248 1769 if (not $previous) { }
0 1769 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 738 1031 if (@tracking and $piece->tag eq $tracking[-1] and $previous->string =~ /\S\z/) { }
598 433 elsif ($next->string =~ /\A\S/ and $previous->string =~ /[[:^alnum:]]\z/ and scalar grep({$_->tag eq $piece->tag;} @processed)) { }
684 738 0 if ($previous->type ne "open_inline")
722 36 26 if ($type eq "close" or $type eq "close_inline")
734 765 31709 if ($piece->type eq 'open_inline') { }
738 30971 elsif ($piece->type eq 'close_inline') { }
736 1191 4913 if $_->type eq "close_inline"
752 13 if (grep {$_->tag eq $piece->tag if $_->type eq 'close_inline';} @pieces) { }
747 738 0 if (@tracking and $tracking[-1] eq $piece->tag) { }
767 1312 31366 if ($piece->type eq 'open') { }
1315 30051 elsif ($piece->type eq 'close') { }
769 3408 9371 if $_->type eq "close"
1299 13 if (grep {$_->tag eq $piece->tag if $_->type eq 'close';} @processed) { }
779 1279 36 if (@tagpile and $tagpile[-1] eq $piece->tag) { }
783 36 1243 if ($pieces[-1]->type eq "open" and $pieces[-1]->tag eq $piece->tag)
814 1746 30880 if ($piece->type eq 'link') { }
1304 29576 elsif ($piece->type eq 'pri_footnote') { }
332 29244 elsif ($piece->type eq 'sec_footnote') { }
815 120 1626 if ($opts{'nolinks'}) { }
824 945 359 if ($insert_primary_footnote and my $pri_fn = $self->document->get_footnote($piece->string)) { }
826 524 421 if ($self->is_html and $piece->string =~ /\A(\s+)/)
837 242 90 if ($insert_secondary_footnote and my $sec_fn = $self->document->get_footnote($piece->string)) { }
839 131 111 if ($self->is_html and $piece->string =~ /\A(\s+)/)
856 510 677 if ($self->is_latex) { }
677 0 elsif ($self->is_html) { }
869 108 402 if ($element->type eq 'secondary_footnote') { }
926 1669 38 unless (defined $long and length $long)
933 425 16 if ($self->document->get_footnote($fn)) { }
948 149 1558 if ($first_anchor and $first_anchor =~ /[A-Za-z0-9]/)
958 313 1394 $body ne $body_for_toc ? :
961 149 1558 if ($anchors)
962 88 61 if ($self->is_html) { }
61 0 elsif ($self->is_latex) { }
973 1556 151 if ($el->type =~ /h([1-4])/)
976 1556 0 defined $body_for_toc ? :
980 0 1556 unless $index
983 876 680 if ($self->is_html)
1002 0 1556 unless $level and defined $string
1003 317 1239 unless (defined $self->{'_toc_entries'})
1007 118 1438 $named ? :
1024 121 912 if defined $self->{'_toc_entries'}
1064 104 117 unless $internal_toc
1079 155 147 if ($self->is_html) { }
147 0 elsif ($self->is_latex) { }
1096 662 130 if ($l =~ /\A( *)(.+?)\z/s) { }
130 0 elsif ($l =~ /\A\s*\z/s) { }
1099 662 0 if (length $text)
1105 0 130 if @stanza
1112 284 18 if @stanza
1113 0 302 if @stanza
1124 212 202 if ($self->is_html) { }
202 0 elsif ($self->is_latex) { }
1133 402 12 if (@$stanza)
1153 70 70 if ($self->is_html) { }
70 0 elsif ($self->is_latex) { }
1179 116 108 if ($self->is_html) { }
108 0 elsif ($self->is_latex) { }
1198 33 83 if ($table->{'specification'})
1204 41 75 if ($table->{'caption'} ne "")
1211 138 210 unless @{$table->{$tablepart};}
1222 237 1151 if ($table->{'specification'})
1264 35 73 if (defined $table->{'caption'} and $table->{'caption'} ne "")
1268 35 73 if ($has_caption) { }
1277 33 75 if ($table->{'specification'}) { }
1286 75 33 unless ($table->{'specification'})
1289 53 55 if (my(@head) = @{$out->{'head'};})
1292 108 0 if (my(@body) = @{$out->{'body'};})
1295 29 79 if (my(@foot) = @{$out->{'foot'};})
1298 75 33 unless ($table->{'specification'})
1302 35 73 if ($has_caption)
1308 35 73 if ($has_caption) { }
1328 174 854 if ($c =~ /\A\s*\:?---+\:?\s*\z/) { }
36 818 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 818 if (@spec and @spec == @$cells) { }
1368 0 224 unless $table
1382 76 1004 if ($r =~ /\A\s*\|\+\s*(.+?)\s*\+\|\s*\z/) { }
1396 70 934 if ($r =~ /\|\|\|/) { }
88 846 elsif ($r =~ /\|\|/) { }
1402 227 777 if ($cells[0] =~ /\A\s*\z/)
1412 69 155 if ($empty_first_cell == @row_cells)
1424 224 780 if ($output->{'counter'} < scalar @cells)
1427 884 120 unless ($output->{'specification'})
1429 66 818 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 158 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 1626 unless defined $link
1531 1152 474 if ($link =~ /\A\[\[ \s* (.+?) # link \s* \]\[ \s* (.+?) # desc \s* \]\]\z /sx) { }
474 0 elsif ($link =~ /\[\[ \s* (.+?) # link \s* \]\]/sx) { }
1565 100 1052 if (my $image = $self->find_image($link))
1572 826 226 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 531 112 if ($self->is_html) { }
112 0 elsif ($self->is_latex) { }
1605 320 154 if (my $image = $self->find_image($link))
1609 16 138 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 72 66 if ($self->is_html) { }
66 0 elsif ($self->is_latex) { }
1659 752 30522 unless ($self->{'_block_table_map'})
2039 430 1208 if ($link =~ /\A$imagere\z/s) { }
2080 237 1151 if ($spec)
2086 117 120 if (my $align = $specs{$spec}) { }
15 105 elsif ($spec =~ /p\{0\.([0-9][0-9])\\textwidth/) { }
2138 254 150 if ($map{$type})
2143 99 305 if ($start and $start =~ /\A[0-9]+\z/ and $start > 1)
2163 96 287 if ($start and $start =~ /\A[0-9]+\z/ and $start > 1)
2173 122 620 if (defined $attributes{'toc_entry'}) { }
2192 609 21751 if (my(@anchors) = map({"Text::Amuse::InlineElement"->new("string", $_, "type", "anchor", "lang", $self->_lang, "fmt", $self->fmt)->stringify;} $el->anchors))