Branch Coverage

blib/lib/Text/Nimble.pm
Criterion Covered Total %
branch 252 280 90.0


line true false branch
20 0 4 unless @_ == 2
21 0 4 unless defined $_[0] and $_[0] =~ /^\w+$/
22 0 2 unless defined $_[1] and !ref($_[1]) || ref $_[1] eq 'ARRAY' || ref $_[1] eq 'HASH' && $_[1]{'tree'} && $_[1]{'macro'}
23 0 4 unless $renderer{$format}
25 2 2 unless ref $nimble eq 'HASH'
27 2 2 wantarray ? :
31 0 5 unless @_ == 1
37 0 5 unless @_ == 1 and defined $_[0] and not ref $_[0]
44 1550 665 if ($lines[$i] =~ /^( *)\S/) { }
665 0 elsif (defined $next_indent and $lines[$i] =~ /^\s*$/) { }
57 30 140 if ($type eq 'nimble') { }
140 0 elsif ($type eq 'raw') { }
58 20 10 ref $arg ? :
60 45 95 ref $arg ? :
69 100 5 defined $$node{'args'}{$arg} ? :
122 0 1155 if @_ or not defined $text or ref $text
126 835 1495 if (@output and $output[-1]{'type'} eq 'text') { }
136 1795 1030 if (defined $plain) { }
70 960 elsif (defined $code) { }
210 750 elsif (defined $styletype) { }
20 730 elsif (defined $entity_literal) { }
70 660 elsif (defined $entity_shorthand) { }
145 515 elsif (defined $bracketcontents) { }
515 0 elsif (defined $char) { }
148 65 80 if ($bracketcontents =~ /^\$(\w+)((?:\s+\w+\=(?:\S*|([\"\'])((?:(?!\\|\g{-2}).|\\.)*)\g{-2}))*)\s*$/) { }
5 75 elsif ($bracketcontents =~ /^raw\s+(\w+)\s+(.+?)\s*$/) { }
25 50 elsif ($bracketcontents =~ /^img\s+(\S+)(?:\s+(.+?))?$/) { }
40 10 elsif ($bracketcontents =~ /^(?:link\s+)?(\S+)(?:\s+(.+?))?$/) { }
152 5 60 unless $macro{$macro_name}
154 60 5 unless (@errors)
158 20 130 if $$node{'args'}{$arg_name}
159 20 130 unless $macro{$macro_name}{'args'}{$arg_name}
160 55 95 if @errors
161 0 95 if $arg_value =~ /^(\[(?:(?:(?-1)*?)|[^\[\]\\]+|\\.|.)*?\])$/
165 35 25 unless (@errors)
170 30 35 if (@errors)
189 30 10 defined $content ? :
206 0 595 if @_ < 1 or @_ > 2
207 0 595 if @_ == 2 and !ref($_[1]) eq 'ARRAY'
211 35 560 $_[1] ? :
218 0 2095 if defined $prev_i and $i == $prev_i
224 30 65 if (@extra_matches = $lines[$i] =~ /$extra_re/)
230 5 2060 if (do { my($meta_key, $meta_value) = $lines[$i] =~ /^\@(\w+)(?:\s+(.*?))?\s*$/ }) { }
15 2045 elsif (my($codeblock_marker, $codeblock_lang) = $lines[$i] =~ /^(\`{3,})(?:\s*(\w+))?\s*$/) { }
105 1940 elsif (my($ul_indent, $ul_content) = $lines[$i] =~ /^\*( +)(.*?)$/) { }
25 1915 elsif (my($ol_indent, $ol_value, $ol_content) = $lines[$i] =~ /^((?:(\d+)|\#)\. +)(.*?)$/) { }
40 1875 elsif (my($dl_indent, $dl_content) = $lines[$i] =~ /^\?( +)(.*?)$/) { }
35 1840 elsif (my($fig_indent, $fig_content) = $lines[$i] =~ /^\%( +)(.*?)$/) { }
10 1830 elsif (my($h_indent, $h_depth, $h_content) = $lines[$i] =~ /^(\!([123456]?) +)(.*?)$/) { }
20 1810 elsif (my($bq_indent, $bq_content) = $lines[$i] =~ /^\"( +)(.*?)$/) { }
10 1800 elsif (my($raw_format, $raw_inline) = $lines[$i] =~ /^\#raw\s+(\w+)(?:\s+(.*?))?\s*$/) { }
55 1745 elsif (my($macro_decl) = $lines[$i] =~ /^\#macro\s+(\w+)\s*$/) { }
45 1700 elsif (my($macro_name) = $lines[$i] =~ /^\$\s*(\w+)\s*$/) { }
655 1045 elsif ($lines[$i] =~ /^\s*$/) { }
55 990 elsif (my($section_end, $header_indent, $header_content) = $lines[$i] =~ /^(\}*)(?:(\{ +)(.*?))?$/) { }
241 15 55 if ($lines[$i] =~ /^\Q$codeblock_marker\E\s*$/) { }
253 150 190 if (($tail) = $lines[$i] =~ /^ $ul_indent(.*?)$/) { }
140 50 elsif (($ul_indent, $ul_content) = $lines[$i] =~ /^\*( +)(.*?)$/) { }
269 35 35 if (($tail) = $lines[$i] =~ /^$ol_indent(.*?)$/) { }
30 5 elsif (($ol_value, $ol_content) = $lines[$i] =~ /^(?:(\d+)|\#)\. (.*?)$/) { }
273 15 15 defined $ol_value ? :
285 50 130 if (($tail) = $lines[$i] =~ /^ $dl_indent(.*?)$/) { }
75 55 elsif (($dl_indent, $dl_content) = $lines[$i] =~ /^\=( +)(.*?)$/) { }
35 20 elsif (($dl_indent, $dl_content) = $lines[$i] =~ /^\?( +)(.*?)$/) { }
303 100 35 if (($tail) = $lines[$i] =~ /^ $fig_indent(.*?)$/) { }
319 0 10 if (($tail) = $$lines[$$i] =~ /^ $figcap_indent(.*?)$/) { }
339 10 10 if (($tail) = $lines[$i] =~ /^$h_indent(.*?)$/) { }
355 65 25 if (($bq_content) = $lines[$i] =~ /^ $bq_indent(.*?)$/) { }
5 20 elsif ($section eq 'quote' and ($bq_indent, $bq_content) = $lines[$i] =~ /^\-( +)(.*?)$/) { }
372 5 5 if (defined $raw_inline) { }
376 30 5 if (my($raw_line) = $lines[$i] =~ /^ +(.*?)\s*$/) { }
392 5 50 if $macro{$macro_decl}
397 45 195 if (defined $block_type and my($block_line) = $lines[$i] =~ /^$block_indent( +.*?)\s*$/) { }
100 95 elsif (my($arg_indent, $arg_name, $arg_type, $arg_inline_default) = $lines[$i] =~ /^( +)\#arg\s+(\w+)\s+(\w+)(?:\s+(\S.*?))?\s*$/) { }
40 55 elsif (my($result_indent, $result_format, $result_inline_default) = $lines[$i] =~ /^( +)\#result\s+(\w+)(?:\s+(\S.*?))?\s*$/) { }
398 25 20 unless (defined $block_internal_indent)
405 10 90 if $$macro{'args'}{$arg_name}
406 10 90 unless $arg_type =~ /^(?:nimble|raw)$/
408 15 85 if (defined $arg_inline_default) { }
415 5 35 if $$macro{'results'}{$result_format}
417 20 20 if (defined $result_inline_default) { }
428 30 25 if (not @errors) { }
433 20 10 if ref $$macro{'results'}{$result_format}{'output'}
448 5 40 unless $macro{$macro_name}
452 25 165 if (defined $arg_block_name and my($block_line) = $lines[$i] =~ /^$block_indent( +.*?)\s*$/) { }
120 45 elsif (my($arg_indent, $arg_name, $arg_inline_default) = $lines[$i] =~ /^( +)(\w+)\:(?:\s+(\S.*?))?\s*$/) { }
453 10 15 unless (defined $block_internal_indent)
458 25 0 unless (@errors)
462 20 100 if $$node{'args'}{$arg_name}
463 20 100 unless $macro{$macro_name}{'args'}{$arg_name}
464 65 55 unless (@errors)
467 110 10 if (defined $arg_inline_default) { }
468 55 55 unless (@errors)
480 15 30 unless (@errors)
484 30 15 if (@errors)
491 625 30 unless @output and $output[-1]{'type'} eq 'space'
496 55 0 if (defined $section_end)
498 0 55 if ($section_end_num > $section_depth)
507 30 25 if (defined $header_content)
510 30 0 defined $section_end ? :
512 25 30 if (($tail) = $lines[$i] =~ /^$header_indent(.*?)$/) { }
527 105 885 if (@output and $output[-1]{'type'} eq 'paragraph') { }
551 5 0 @error ? :
556 0 4 unless @_ == 1
557 0 4 unless ref $_[0] eq 'HASH' and $_[0]{'tree'} and $_[0]{'macro'}
587 88 12 defined $filters ? :
589 0 100 if @unknown_filters
599 1420 2456 if (ref $node eq 'ARRAY')
601 324 1096 if (@$node == 1 and $$node[0]{'type'} eq 'paragraph') { }
604 1096 0 if ref $node eq 'ARRAY'
609 360 2096 if (do { $type eq 'paragraph' }) { }
32 2064 elsif ($type eq 'dl') { }
60 2004 elsif ($type eq 'dt') { }
60 1944 elsif ($type eq 'dd') { }
80 1864 elsif ($type eq 'emphasis') { }
20 1844 elsif ($type eq 'ol') { }
28 1816 elsif ($type eq 'figure') { }
24 1792 elsif ($type eq 'figcaption') { }
24 1768 elsif ($type eq 'h') { }
84 1684 elsif ($type eq 'strong') { }
32 1652 elsif ($type eq 'link') { }
20 1632 elsif ($type eq 'img') { }
44 1588 elsif ($type eq 'li') { }
56 1532 elsif ($type eq 'code') { }
12 1520 elsif ($type eq 'codeblock') { }
1184 336 elsif ($type eq 'text') { }
72 264 elsif ($type eq 'entity') { }
80 184 elsif ($type eq 'ul') { }
12 172 elsif ($type eq 'raw') { }
68 104 elsif ($type eq 'error') { }
16 88 elsif ($type eq 'blockquote') { }
24 64 elsif ($type eq 'section_start') { }
24 40 elsif ($type eq 'section_end') { }
40 0 elsif ($type eq 'macro') { }
622 24 20 defined $$node{'value'} ? :
628 12 0 $$node{'format'} eq 'html' ? :
632 4 12 if $$node{'cite'}
640 16 8 @{$$node{'content'};} == 1 && $$node{'content'}[0]{'type'} eq 'paragraph' ? :
24 0 @{$$node{'content'};} ? :
648 0 40 unless $macro{$$node{'macro'}}{'results'}{'html'}