Branch Coverage

blib/lib/Text/Textile.pm
Criterion Covered Total %
branch 122 872 13.9


])
line true false branch
18 24 0 unless exists $options{$_}
21 30 2 unless exists $options{$_}
25 0 8 if (exists $options{'css'})
29 0 8 if (exists $options{'flavor'}) { }
42 0 0 if (ref $opt eq 'HASH') { }
48 0 0 if ($opt eq 'charset') { }
0 0 elsif ($opt eq 'css') { }
0 0 elsif ($opt eq 'flavor') { }
63 0 0 if @_
69 0 0 if (@_)
77 0 0 if (@_)
85 8 0 if (@_)
88 8 0 if ($flavor =~ /^xhtml(\d)?(\D|$)/) { }
0 0 elsif ($flavor =~ /^html/) { }
89 0 8 if ($1 eq '2') { }
110 8 0 if $$self{'css_mode'} and not exists $$self{'css'}
117 8 0 if (@_)
119 8 0 if (ref $css eq 'HASH') { }
124 0 0 if $$self{'css_mode'} and not exists $$self{'css'}
127 8 0 $$self{'css_mode'} ? :
132 0 0 if (@_)
134 0 0 if ($$self{'charset'} =~ /^utf-?8$/i) { }
145 0 0 if @_
151 0 0 if @_
157 0 0 if @_
163 0 0 if @_
169 0 0 if @_
175 0 0 if @_
181 0 0 if @_
187 0 0 if @_
345 6 2 unless (ref $self)
353 0 8 unless defined $str
368 0 8 if $$self{'trim_spaces'}
374 8 0 unless ($$self{'disable_html'})
424 12 20 if ($para =~ /^\n+$/s)
425 0 12 if ($sticky and defined $stickybuff) { }
433 0 20 if ($sticky) { }
443 0 20 if ($para =~ /^(h[1-6]|p|bq|bc|fn\d+) ((?:$Text::Textile::clstyfiltre*|$Text::Textile::halignre)*) (\.\.?) (?::(\d+|$Text::Textile::urlre))?\ /gx) { }
0 20 elsif ($para =~ /^$/) { }
0 20 elsif ($para =~ /^clear([<>]+)?\.$/) { }
0 20 elsif ($sticky and defined $stickybuff and $block eq 'table' || $block eq 'dl') { }
5 15 elsif ($para =~ /^(?:$Text::Textile::halignre|$Text::Textile::clstypadre*)* [\*\#] (?:$Text::Textile::halignre|$Text::Textile::clstypadre*)* \ /x) { }
0 15 elsif ($para =~ /^(?:table(?:$Text::Textile::tblalignre|$Text::Textile::clstypadre*)* (\.\.?)\s+)? (?:_|$Text::Textile::alignre|$Text::Textile::clstypadre*)*\|/x) { }
0 15 elsif ($para =~ /^(?:dl(?:$Text::Textile::clstyre)*(\.\.?)\s+)/) { }
447 0 0 if ($sticky)
448 0 0 if ($block eq 'bc') { }
0 0 elsif ($block eq 'bq') { }
0 0 elsif ($block eq 'table') { }
0 0 elsif ($block eq 'dl') { }
457 0 0 unless defined $table_out
462 0 0 unless defined $dl_out
473 0 0 if ($3 eq '..') { }
483 0 0 if ($block =~ /^h([1-6])$/)
484 0 0 if ($$self{'head_offset'})
488 0 0 if ($params =~ /($Text::Textile::halignre+)/)
492 0 0 if (defined $params)
493 0 0 if ($params =~ /\|(.+)\|/)
497 0 0 if ($params =~ /{([^}]+)}/)
502 0 0 if ($params =~ /\(([A-Za-z0-9_\-\ ]+?)(?:\#(.+?))?\)/ or $params =~ /\(([A-Za-z0-9_\-\ ]+?)?(?:\#(.+?))\)/)
504 0 0 if ($1 or $2)
507 0 0 if ($class) { }
0 0 elsif ($id) { }
514 0 0 if ($params =~ /(\(+)/)
518 0 0 if ($params =~ /(\)+)/)
522 0 0 if ($params =~ /\[(.+?)\]/)
524 0 0 if ($block eq 'bc')
536 0 0 if ($1 eq '<') { }
0 0 elsif ($1 eq '>') { }
558 0 0 if (defined $1 and $1 eq '..') { }
568 0 0 if (defined $1 and $1 eq '..') { }
577 5 15 if (defined $buffer)
582 0 15 unless @lines
590 0 15 if ($block eq 'bc') { }
0 15 elsif ($block eq 'bq') { }
0 15 elsif ($block =~ /fn(\d+)/) { }
591 0 0 if ($sticky <= 1)
594 0 0 if $bqlang
595 0 0 if ($align)
597 0 0 if ($$self{'css_mode'}) { }
598 0 0 if ($padleft || $padright and $alignment eq 'left' || $alignment eq 'right') { }
606 0 0 if $alignment
609 0 0 if $padleft
610 0 0 if $padright
611 0 0 if $clear
612 0 0 if $class
613 0 0 if $class
614 0 0 if $id
615 0 0 if $style
616 0 0 if $style
617 0 0 if $lang
629 0 0 if ($sticky == 0)
635 0 0 if ($sticky <= 1)
637 0 0 if ($align)
639 0 0 if ($$self{'css_mode'}) { }
640 0 0 if ($padleft || $padright and $alignment eq 'left' || $alignment eq 'right') { }
648 0 0 if $alignment
651 0 0 if $padleft
652 0 0 if $padright
653 0 0 if $clear
654 0 0 if $class
655 0 0 if $class
656 0 0 if $id
657 0 0 if $style
658 0 0 if $style
659 0 0 if $lang
660 0 0 if defined $cite
668 0 0 if $$self{'css'}{'class_footnote'}
669 0 0 if ($align)
671 0 0 if ($$self{'css_mode'}) { }
672 0 0 if ($padleft || $padright and $alignment eq 'left' || $alignment eq 'right') { }
683 0 0 if $padleft
684 0 0 if $padright
685 0 0 if $clear
686 0 0 if $class
687 0 0 if $class
689 0 0 if $style
690 0 0 if $style
691 0 0 if $lang
699 0 15 if ($align)
701 0 0 if ($$self{'css_mode'}) { }
702 0 0 if ($padleft || $padright and $alignment eq 'left' || $alignment eq 'right') { }
713 0 15 if $padleft
714 0 15 if $padright
715 0 15 if $clear
716 0 15 if $class
717 0 15 if $class
718 0 15 if $id
719 0 15 if $style
720 0 15 if $style
721 0 15 if $lang
722 0 15 if defined $cite and $block eq 'bq'
729 0 15 if ($block eq 'bq') { }
730 0 0 unless $buffer =~ /]/
731 0 0 if ($sticky == 0)
738 0 15 if ($buffer =~ /$Text::Textile::blocktags/) { }
742 0 15 if defined $filter
747 0 8 if ($sticky)
748 0 0 if ($block eq 'bc') { }
0 0 elsif ($block eq 'bq') { }
0 0 elsif ($block eq 'table' and $stickybuff) { }
0 0 elsif ($block eq 'dl' and $stickybuff) { }
755 0 0 if defined $table_out
758 0 0 if defined $dl_out
769 8 0 if ($$self{'flavor'} =~ /^xhtml/i)
779 31 0 defined $args{'text'} ? :
788 2 29 if ($buffer =~ /
797 0 31 if ($$token[0] eq 'tag') { }
811 35 0 if (not $line =~ /($Text::Textile::blocktags)/ and $line =~ /^[^<]/ || $line =~ />[^<]/ || !($line =~ /
814 0 35 if ($$self{'_line_open'}) { }
815 0 0 if $result ne ''
818 4 31 if ($needs_closing) { }
822 0 31 if $result ne ''
827 0 0 if ($needs_closing) { }
830 0 0 if $result ne ''
846 31 0 if ($$self{'do_quotes'})
869 31 0 defined $args{'text'} ? :
919 0 0 defined $3 ? :
0 0 defined $4 ? :
0 0 defined $2 ? :
946 4 0 defined $3 ? :
0 4 defined $4 ? :
4 0 defined $2 ? :
970 0 31 if ($$self{'flavor'} =~ /^xhtml2/)
982 0 31 if ($text =~ /[^ ]\[\d+\]/)
984 0 0 if $$self{'css'}{'class_footnote'}
1002 0 31 if ($$self{'preserve_spaces'})
1014 31 0 if (my $caps = $$self{'css'}{'class_caps'})
1051 31 0 defined $args{'text'} ? :
1060 0 20 if ($text =~ s/(?:^|(?<=[\s>'"])|([{[])) # "' $1 - pre $qf # (?:($Text::Textile::clstyre*))? # $2 - attributes ([^$cls\s].*?) # $3 - content (?<=\S)$qf # (?:$|([\]}])|(?=$Text::Textile::punct{1,2}|\s)) # $4 - post /$self->format_tag('tag', $r, 'marker', $f, 'pre', $1, 'text', $3, 'clsty', $2, 'post', $4);/egmx)
1095 0 0 if (defined $$self{'macros'}{$macro})
1100 0 0 if ($Have_Charnames)
1102 0 0 if (defined(my $unicode = charnames::vianame(uc $macro)))
1114 0 0 defined $args{'pre'} ? :
1115 0 0 defined $args{'text'} ? :
1116 0 0 defined $args{'post'} ? :
1120 0 0 if ($$self{'flavor'} =~ /^xhtml2/ and defined $cite and $cite) { }
1133 5 0 defined $args{'text'} ? :
1138 0 5 if $lang
1146 4 0 unless defined $style
1147 0 4 if defined $class
1150 0 4 if ($clsty and $clsty =~ /{([^}]+)}/)
1156 0 0 if ($clsty and $clsty =~ /\(([A-Za-z0-9_\- ]+?)(?:#(.+?))?\)/ || $clsty =~ /\(([A-Za-z0-9_\- ]+?)?(?:#(.+?))\)/)
1158 0 0 if ($1 or $2)
1159 0 0 if ($class) { }
1165 0 0 if ($class)
1168 0 0 if ($id)
1173 0 4 if ($clsty and $clsty =~ /(\(+)/)
1177 0 4 if ($clsty and $clsty =~ /(\)+)/)
1181 0 4 if ($clsty and $clsty =~ /\[(.+?)\]/)
1187 0 4 if $padleft
1188 0 4 if $padright
1191 0 4 if ($class)
1196 0 4 if $id
1197 0 4 if $style
1198 0 4 if $lang
1208 0 0 defined $args{'text'} ? :
1209 0 0 defined $args{'pre'} ? :
1210 0 0 defined $args{'post'} ? :
1211 0 0 defined $args{'clsty'} ? :
1215 0 0 if $attr
1224 0 0 defined $args{'text'} ? :
1227 0 0 if ($lines[0] =~ /^(dl($Text::Textile::clstyre*?)\.\.?(?:\ +|$))/)
1236 0 0 if ($line =~ m[^((?:$Text::Textile::clstyre*)(?:[^\ ].*?)(?
1237 0 0 if $dt and $dd
1244 0 0 if $dt and $dd
1248 0 0 if $clsty
1249 0 0 if $attr
1259 0 0 if ($dt =~ /^($Text::Textile::clstyre*)/)
1262 0 0 if ($param =~ /\[([A-Za-z]+?)\]/)
1267 0 0 if ($dd =~ /^($Text::Textile::clstyre*)/)
1272 0 0 if ($dtlang and $param =~ /\[([A-Za-z]+?)\]/)
1275 0 0 $dtlang ? :
1279 0 0 if $dtattr
1281 0 0 if ($dd =~ /\n\n/) { }
1282 0 0 if $dd =~ /\n\n/
1287 0 0 if $ddattr
1297 5 0 defined $args{'text'} ? :
1308 12 0 if ($line =~ /^((?:$Text::Textile::clstypadre*|$Text::Textile::halignre)*) ([\#\*]+) ((?:$Text::Textile::halignre|$Text::Textile::clstypadre*)*) \ (.+)$/x)
1312 7 5 if ($item ne '')
1313 0 7 if ($item =~ /\n/)
1314 0 0 if ($$self{'_line_open'}) { }
1331 0 12 if ($blockparam =~ /($Text::Textile::clstypadre+)/)
1334 0 12 if ($blockparam =~ /($Text::Textile::halignre+)/)
1337 0 12 if ($itemparam =~ /($Text::Textile::clstypadre+)/)
1340 0 12 if ($itemparam =~ /($Text::Textile::halignre+)/)
1343 0 12 if $itemclsty
1344 5 7 if ($depth > $last_depth) { }
0 7 elsif ($depth < $last_depth) { }
1348 0 5 if ($blockclsty)
1350 0 0 if $blockattr
1353 0 5 if $itemattr
1358 0 0 if $j == $depth
1362 0 0 if ($depth)
1364 0 0 if $itemattr
1369 0 7 if $itemattr
1374 0 12 if $item ne ''
1378 0 5 if ($item =~ /\n/)
1379 0 0 if ($$self{'_line_open'}) { }
1389 5 0 if $j == 1
1392 0 5 if $j != $last_depth
1401 0 0 defined $args{'text'} ? :
1402 0 0 defined $args{'pre'} ? :
1403 0 0 defined $args{'post'} ? :
1407 0 0 if ($filters)
1415 0 0 if ($str =~ s/(

){$count}/$1/gs)

1420 0 0 if ($inline)
1433 4 0 defined $args{'text'} ? :
1434 4 0 defined $args{'linktext'} ? :
1439 0 4 if (not defined $url or $url eq '')
1442 0 4 if ($$self{'links'} and $$self{'links'}{$url})
1451 0 4 if $attr
1452 4 0 if (defined $title)
1454 0 4 if length $title
1464 4 0 defined $args{'url'} ? :
1465 0 4 if ($url =~ /^(mailto:)?([-\+\w]+\@[-\w]+(\.\w[-\w]*)+)$/)
1468 4 0 unless ($url =~ m[^(/|\./|\.\./|#)])
1469 0 4 unless $url =~ /^(?:https?|ftp|mailto|nntp|telnet)/
1481 0 0 defined $args{'text'} ? :
1482 0 0 defined $args{'pre'} ? :
1483 0 0 defined $args{'post'} ? :
1484 0 0 defined $args{'cite'} ? :
1491 0 0 if (defined $align)
1492 0 0 if ($$self{'css_mode'}) { }
1494 0 0 if $alignment
1495 0 0 if $alignment
1498 0 0 if $alignment
1502 0 0 if $attr
1503 0 0 if (defined $cite)
1515 0 0 defined $args{'src'} ? :
1516 0 0 defined $args{'pre'} ? :
1517 0 0 defined $args{'post'} ? :
1523 0 0 if length $src == 0
1525 0 0 if ($$self{'flavor'} =~ /^xhtml2/) { }
1527 0 0 if ($src =~ /(?:\.jpeg|\.jpg)$/i) { }
0 0 elsif ($src =~ /\.gif$/i) { }
0 0 elsif ($src =~ /\.png$/i) { }
0 0 elsif ($src =~ /\.tiff$/i) { }
1537 0 0 if $type
1543 0 0 if (defined $align)
1544 0 0 if ($$self{'css_mode'}) { }
1546 0 0 if $alignment
1547 0 0 if $alignment
1549 0 0 if ($alignment)
1550 0 0 $alignment =~ /(top|bottom)/ ? :
1551 0 0 if $imgvalign
1552 0 0 if $alignment
1556 0 0 if $alignment
1560 0 0 if (defined $extra)
1564 0 0 if (not $pct) { }
1569 0 0 unless ($pctw or $pcth)
1571 0 0 if $w and $w eq '*'
1572 0 0 if $h and $h eq '*'
1573 0 0 unless ($w)
1576 0 0 unless ($h)
1581 0 0 unless defined $alt
1582 0 0 unless ($$self{'flavor'} =~ /^xhtml2/)
1585 0 0 if ($w and $h) { }
1586 0 0 if (not $$self{'flavor'} =~ /^xhtml2/) { }
1593 0 0 if ($image_w and $image_h and $w || $h) { }
1595 0 0 if ($w and not $h) { }
0 0 elsif ($h and not $w) { }
1605 0 0 if ($w and $h)
1606 0 0 if ($pctw or $pcth)
1610 0 0 if (not $$self{'flavor'} =~ /^xhtml2/) { }
1618 0 0 if $attr
1619 0 0 if ($$self{'flavor'} =~ /^xhtml2/) { }
0 0 elsif ($$self{'flavor'} =~ /^xhtml/) { }
1626 0 0 if (defined $link)
1638 0 0 defined $args{'text'} ? :
1644 0 0 if (not $lines[$i] =~ /\|\s*$/) { }
1645 0 0 if ($i + 1 < $line_count) { }
1646 0 0 if $i + 1 <= $#lines
1658 0 0 if ($rows[0] =~ /^table[^\.]/)
1664 0 0 if ($row =~ /^($Text::Textile::tblalignre)/)
1667 0 0 if $1
1668 0 0 if $1
1670 0 0 if ($row =~ /^($Text::Textile::clstypadre)/)
1673 0 0 if $clsty
1674 0 0 if ($clsty =~ /{([^}]+)}/)
1677 0 0 if $tstyle
1679 0 0 if ($clsty =~ /\(([A-Za-z0-9_\- ]+?)(?:#(.+?))?\)/ or $clsty =~ /\(([A-Za-z0-9_\- ]+?)?(?:#(.+?))\)/)
1681 0 0 if ($1 or $2)
1687 0 0 if $clsty =~ /(\(+)/
1688 0 0 if $clsty =~ /(\)+)/
1689 0 0 if $clsty =~ /\[(.+?)\]/
1690 0 0 if $clsty
1707 0 0 unless defined $cols[0]
1708 0 0 if ($cols[0] =~ /_/)
1712 0 0 if ($cols[0] =~ /{([^}]+)}/)
1716 0 0 if ($cols[0] =~ /\(([^\#]+?)?(#(.+))?\)/)
1721 0 0 if $cols[0] =~ /($Text::Textile::alignre)/
1723 0 0 if ($rowspans[$c])
1725 0 0 if $rowspans[$c] > 1
1733 0 0 if ($col =~ m(^(((_|[/\\]\d+|$Text::Textile::alignre|$Text::Textile::clstypadre)+)\. )))
1740 0 0 if ($colparams =~ /^(_|$Text::Textile::alignre)/g)
1743 0 0 if $1
1744 0 0 if $1
1746 0 0 if ($colparams =~ /^($Text::Textile::clstypadre)/g)
1749 0 0 if $clsty
1750 0 0 if ($clsty =~ /{([^}]+)}/)
1754 0 0 if ($clsty =~ /\(([A-Za-z0-9_\- ]+?)(?:#(.+?))?\)/ or $clsty =~ /\(([A-Za-z0-9_\- ]+?)?(?:#(.+?))\)/)
1756 0 0 if ($1 or $2)
1759 0 0 if ($colclass) { }
0 0 elsif ($colid) { }
1766 0 0 if ($clsty =~ /(\(+)/)
1770 0 0 if ($clsty =~ /(\)+)/)
1774 0 0 if ($clsty =~ /\[(.+?)\]/)
1778 0 0 if $clsty
1780 0 0 if ($colparams =~ /^\\(\d+)/)
1783 0 0 if $1
1785 0 0 if ($colparams =~ m[/(\d+)])
1786 0 0 if $1
1788 0 0 if $1
1793 0 0 if (length $attrs)
1794 0 0 if $attrs =~ /_/
1795 0 0 if $attrs =~ /($Text::Textile::alignre)/ and length $1
1797 0 0 if ($attrs =~ /<>/) { }
0 0 elsif ($attrs =~ /
0 0 elsif ($attrs =~ /=/) { }
0 0 elsif ($attrs =~ />/) { }
1806 0 0 if ($attrs =~ /\^/) { }
0 0 elsif ($attrs =~ /~/) { }
0 0 elsif ($attrs =~ /-/) { }
1814 0 0 if $rowheader
1815 0 0 if $header
1817 0 0 if (length $col) { }
1820 0 0 $header ? :
1821 0 0 if (defined $colalign)
1824 0 0 if $halign
1826 0 0 if $valign
1829 0 0 if $colpadl
1830 0 0 if $colpadr
1831 0 0 if $colclass
1832 0 0 if $colid
1833 0 0 if $colstyle
1834 0 0 if $colstyle
1835 0 0 if $collang
1836 0 0 if $colspan > 1
1837 0 0 if ($rowspan || 0) > 1
1842 0 0 if ($col =~ /\n\n/ or $col =~ /^(?:$Text::Textile::halignre|$Text::Textile::clstypadre*)* [\*\#] (?:$Text::Textile::clstypadre*|$Text::Textile::halignre)*\ /x) { }
1850 0 0 $header ? :
1852 0 0 if $colspan
1854 0 0 if $colspan == 0
1858 0 0 if ($colspan > 1)
1861 0 0 $colspan > 1 ? :
1868 0 0 if ($rowalign)
1870 0 0 if $valign
1872 0 0 if $rowclass
1873 0 0 if $rowid
1874 0 0 if $rowstyle
1881 0 0 if ($talign)
1882 0 0 if ($$self{'css_mode'}) { }
1885 0 0 if ($talign eq '=') { }
1888 0 0 if $alignment
1890 0 0 if $alignment
1893 0 0 if $alignment
1896 0 0 if $tpadl
1897 0 0 if $tpadr
1898 0 0 if $tclass
1899 0 0 if $tclass
1900 0 0 if $tid
1901 0 0 if $tstyle
1902 0 0 if $tstyle
1903 0 0 if $tlang
1904 0 0 if $tclass or $tid or $tstyle
1907 0 0 if ($table =~ m[
1919 0 0 unless defined $text
1922 0 0 unless ref $filters eq 'HASH'
1926 0 0 unless $$filters{$filter}
1927 0 0 if (ref $$filters{$filter} eq 'CODE')
1942 0 36 unless defined $html
1943 7 29 if $$self{'disable_encode_entities'}
1944 29 0 if ($Have_Entities and $$self{'char_encoding'}) { }
1967 4 0 unless defined $html
1968 0 0 unless $html =~ /[^\w\s]/
1969 0 0 if ($can_double_encode) { }
1991 0 0 if ($Have_ImageSize)
1992 0 0 if (-f $file) { }
1995 0 0 if (my $docroot = $self->docroot)
1998 0 0 if (-f $fullpath)
2012 0 0 ord $1 > 255 ? :
2022 0 0 ord $1 > 255 ? :
2226 0 0 if ($align =~ /<>/) { }
0 0 elsif ($align =~ /
0 0 elsif ($align =~ />/) { }
0 0 elsif ($align =~ /=/) { }
2241 0 0 if ($align =~ /\^/) { }
0 0 elsif ($align =~ /~/) { }
0 0 elsif ($align =~ /-/) { }
2260 0 0 if (${$post;} and ${$pre;} and (my $open = substr(${$pre;}, 0, 1)) =~ /[{[]/)
2262 0 0 if ($open eq '{' and $close eq '}' or $open eq '[' and $close eq ']') { }
2267 0 0 unless $close =~ /[}\]]/
2268 0 0 if ($open eq '{' and $close eq '}' or $open eq '[' and $close eq ']')
2303 0 0 if ($pos < $tag_start)
2306 0 0 if ($whole_tag =~ /^[[{]?\@/) { }
2317 2 0 if $pos < $len