blib/lib/Blatte/HTML.pm

filter: Statementstmt 71.2% 220 / 309 Branchbran 94.0% 47 / 50 Conditioncond 100% 24 / 24 MC/DCmcdc 100% 14 / 14 Subroutinesub 20.5% 23 / 112 Podpod 100% 2 / 2 totaltotal 64.5% 330 / 511 CC 35 SCAR 20.7
CC
35
Cov
76%
__ANON__
32.0
make_start_tag
4.0
__ANON__
1.1
CRAP 8.0
↑ Summary
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Blatte::HTML::Element;
4  
5 8 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
6 8 my $class = shift;
7 8 bless [@_], $class;
8 }
9  
10 36 ▶sub name { $_[0]->[0] }
Subroutine name: called CC=1 SCAR=0.0
11  
12 8 ▶sub attrs { $_[0]->[1] }
Subroutine attrs: called CC=1 SCAR=0.0
13  
14 6 ▶sub content {
Subroutine content: called CC=1 SCAR=0.0
15 6 my $self = shift;
16 6 @$self[2..$#$self];
17 }
18  
19 package Blatte::HTML;
20  
21 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 @Blatte::HTML::builtins = qw($html_bool_yes $html_bool_no
23 $html_p_yes $html_p_no
24 $html_ent_yes $html_ent_no
25 $a $abbr $acronym $address $applet $area $b
26 $base $basefont $bdo $big $blockquote $body $br
27 $button $caption $center $cite $code $col
28 $colgroup $dd $del $dfn $dir $div $dl $dt $em
29 $fieldset $font $form $frame $frameset $h1 $h2
30 $h3 $h4 $h5 $h6 $head $hr $html $i $iframe $img
31 $input $ins $isindex $kbd $label $legend $li
32 $link $map $menu $meta $noframes $noscript
33 $object $ol $optgroup $option $p $param $pre $q
34 $s $samp $script $select $small $span $strike
35 $strong $style $sub $sup $table $tbody $td
36 $textarea $tfoot $th $thead $title $tr $tt $u
37 $ul $var);
38 }
39  
40 3 ▶use vars (qw(@ISA @EXPORT @EXPORT_OK $VERSION), @Blatte::HTML::builtins);
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 3 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 3 @ISA = qw(Exporter);
45  
46 3 @EXPORT = @Blatte::HTML::builtins;
47 3 @EXPORT_OK = qw(make_start_tag render);
48  
49 3 $VERSION = '0.9';
50  
51 3 ▶use Blatte;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 3 ▶use HTML::Entities;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 3 ▶use HTML::Tagset;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 3 ▶use Symbol;
Subroutine BEGIN: called CC=1 SCAR=0.0
55  
56 3 my $_html_bool_yes = gensym();
57 3 my $_html_bool_no = gensym();
58  
59 1 ▶$html_bool_yes = sub { $_html_bool_yes };
Subroutine __ANON__: called CC=1 SCAR=0.0
60 1 ▶$html_bool_no = sub { $_html_bool_no };
Subroutine __ANON__: called CC=1 SCAR=0.0
61  
62 0 ▶$html_p_yes = sub { new Blatte::HTML::Element('_p', 1, @_[1 .. $#_]) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
63 1 ▶$html_p_no = sub { new Blatte::HTML::Element('_p', 0, @_[1 .. $#_]) };
Subroutine __ANON__: called CC=1 SCAR=0.0
64 0 ▶$html_ent_yes = sub { new Blatte::HTML::Element('_ent', 1, @_[1 .. $#_]) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
65 1 ▶$html_ent_no = sub { new Blatte::HTML::Element('_ent', 0, @_[1 .. $#_]) };
Subroutine __ANON__: called CC=1 SCAR=0.0
66  
67 1 ▶$a = sub { new Blatte::HTML::Element('a', @_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
68 0 ▶$abbr = sub { new Blatte::HTML::Element('abbr', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
69 0 ▶$acronym = sub { new Blatte::HTML::Element('acronym', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
70 0 ▶$address = sub { new Blatte::HTML::Element('address', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
71 0 ▶$applet = sub { new Blatte::HTML::Element('applet', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
72 0 ▶$area = sub { new Blatte::HTML::Element('area', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
73 2 ▶$b = sub { new Blatte::HTML::Element('b', @_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
74 0 ▶$base = sub { new Blatte::HTML::Element('base', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
75 0 ▶$basefont = sub { new Blatte::HTML::Element('basefont', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
76 0 ▶$bdo = sub { new Blatte::HTML::Element('bdo', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
77 0 ▶$big = sub { new Blatte::HTML::Element('big', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
78 0 ▶$blockquote = sub { new Blatte::HTML::Element('blockquote', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
79 0 ▶$body = sub { new Blatte::HTML::Element('body', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
80 0 ▶$br = sub { new Blatte::HTML::Element('br', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
81 0 ▶$button = sub { new Blatte::HTML::Element('button', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
82 0 ▶$caption = sub { new Blatte::HTML::Element('caption', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
83 0 ▶$center = sub { new Blatte::HTML::Element('center', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
84 0 ▶$cite = sub { new Blatte::HTML::Element('cite', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
85 0 ▶$code = sub { new Blatte::HTML::Element('code', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
86 0 ▶$col = sub { new Blatte::HTML::Element('col', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
87 0 ▶$colgroup = sub { new Blatte::HTML::Element('colgroup', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
88 0 ▶$dd = sub { new Blatte::HTML::Element('dd', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
89 0 ▶$del = sub { new Blatte::HTML::Element('del', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
90 0 ▶$dfn = sub { new Blatte::HTML::Element('dfn', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
91 0 ▶$dir = sub { new Blatte::HTML::Element('dir', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
92 0 ▶$div = sub { new Blatte::HTML::Element('div', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
93 0 ▶$dl = sub { new Blatte::HTML::Element('dl', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
94 0 ▶$dt = sub { new Blatte::HTML::Element('dt', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
95 0 ▶$em = sub { new Blatte::HTML::Element('em', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
96 0 ▶$fieldset = sub { new Blatte::HTML::Element('fieldset', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
97 0 ▶$font = sub { new Blatte::HTML::Element('font', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
98 0 ▶$form = sub { new Blatte::HTML::Element('form', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
99 0 ▶$frame = sub { new Blatte::HTML::Element('frame', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
100 0 ▶$frameset = sub { new Blatte::HTML::Element('frameset', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
101 0 ▶$h1 = sub { new Blatte::HTML::Element('h1', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
102 0 ▶$h2 = sub { new Blatte::HTML::Element('h2', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
103 0 ▶$h3 = sub { new Blatte::HTML::Element('h3', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
104 0 ▶$h4 = sub { new Blatte::HTML::Element('h4', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
105 0 ▶$h5 = sub { new Blatte::HTML::Element('h5', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
106 0 ▶$h6 = sub { new Blatte::HTML::Element('h6', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
107 0 ▶$head = sub { new Blatte::HTML::Element('head', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
108 0 ▶$hr = sub { new Blatte::HTML::Element('hr', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
109 0 ▶$html = sub { new Blatte::HTML::Element('html', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
110 0 ▶$i = sub { new Blatte::HTML::Element('i', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
111 0 ▶$iframe = sub { new Blatte::HTML::Element('iframe', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
112 2 ▶$img = sub { new Blatte::HTML::Element('img', @_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
113 0 ▶$input = sub { new Blatte::HTML::Element('input', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
114 0 ▶$ins = sub { new Blatte::HTML::Element('ins', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
115 0 ▶$isindex = sub { new Blatte::HTML::Element('isindex', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
116 0 ▶$kbd = sub { new Blatte::HTML::Element('kbd', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
117 0 ▶$label = sub { new Blatte::HTML::Element('label', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
118 0 ▶$legend = sub { new Blatte::HTML::Element('legend', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
119 0 ▶$li = sub { new Blatte::HTML::Element('li', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
120 0 ▶$link = sub { new Blatte::HTML::Element('link', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
121 0 ▶$map = sub { new Blatte::HTML::Element('map', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
122 0 ▶$menu = sub { new Blatte::HTML::Element('menu', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
123 0 ▶$meta = sub { new Blatte::HTML::Element('meta', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
124 0 ▶$noframes = sub { new Blatte::HTML::Element('noframes', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
125 0 ▶$noscript = sub { new Blatte::HTML::Element('noscript', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
126 0 ▶$object = sub { new Blatte::HTML::Element('object', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
127 0 ▶$ol = sub { new Blatte::HTML::Element('ol', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
128 0 ▶$optgroup = sub { new Blatte::HTML::Element('optgroup', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
129 0 ▶$option = sub { new Blatte::HTML::Element('option', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
130 1 ▶$p = sub { new Blatte::HTML::Element('p', @_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
131 0 ▶$param = sub { new Blatte::HTML::Element('param', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
132 0 ▶$pre = sub { new Blatte::HTML::Element('pre', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
133 0 ▶$q = sub { new Blatte::HTML::Element('q', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
134 0 ▶$s = sub { new Blatte::HTML::Element('s', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
135 0 ▶$samp = sub { new Blatte::HTML::Element('samp', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
136 0 ▶$script = sub { new Blatte::HTML::Element('script', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
137 0 ▶$select = sub { new Blatte::HTML::Element('select', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
138 0 ▶$small = sub { new Blatte::HTML::Element('small', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
139 0 ▶$span = sub { new Blatte::HTML::Element('span', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
140 0 ▶$strike = sub { new Blatte::HTML::Element('strike', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
141 0 ▶$strong = sub { new Blatte::HTML::Element('strong', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
142 0 ▶$style = sub { new Blatte::HTML::Element('style', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
143 0 ▶$sub = sub { new Blatte::HTML::Element('sub', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
144 0 ▶$sup = sub { new Blatte::HTML::Element('sup', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
145 0 ▶$table = sub { new Blatte::HTML::Element('table', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
146 0 ▶$tbody = sub { new Blatte::HTML::Element('tbody', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
147 0 ▶$td = sub { new Blatte::HTML::Element('td', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
148 0 ▶$textarea = sub { new Blatte::HTML::Element('textarea', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
149 0 ▶$tfoot = sub { new Blatte::HTML::Element('tfoot', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
150 0 ▶$th = sub { new Blatte::HTML::Element('th', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
151 0 ▶$thead = sub { new Blatte::HTML::Element('thead', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
152 0 ▶$title = sub { new Blatte::HTML::Element('title', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
153 0 ▶$tr = sub { new Blatte::HTML::Element('tr', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
154 0 ▶$tt = sub { new Blatte::HTML::Element('tt', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
155 0 ▶$u = sub { new Blatte::HTML::Element('u', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
156 0 ▶$ul = sub { new Blatte::HTML::Element('ul', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
157 0 ▶$var = sub { new Blatte::HTML::Element('var', @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
158  
159 # Hmm, why did HTML::Tagset neglect to do this?
160 3 my %p_closure_barriers = map { ($_ => 1) } @HTML::Tagset::p_closure_barriers;
161  
162 6 ▶sub make_start_tag {
Subroutine make_start_tag: called CC=4 SCAR=13.9
Pod documented
163 6 my $obj = shift;
164 6 my $result = $obj->name();
165 6 my $attrs = $obj->attrs();
166 6 foreach my $attr (keys %$attrs) {
167 3 my $val = $attrs->{$attr};
168 3 ▶ if ($val ne $_html_bool_no) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val ne $_html_bool_no) 2 1 3
169 2 ▶ if ($val eq $_html_bool_yes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val eq $_html_bool_yes) { } 1 1 2
170 1 $result .= " $attr";
171 } else {
172 1 $result .= sprintf(' %s="%s"',
173 $attr,
174 &encode_entities(&Blatte::flatten($val, '')));
175 }
176 }
177 }
178 6 "<$result>";
179 }
180  
181 10 ▶sub render {
Subroutine render: called CC=1 SCAR=0.0
Pod documented
182 10 my($val, $render_cb) = @_;
183 10 my $do_p = 1;
184 10 my $do_entities = 1;
185 10 my @stack;
186 my $traverse_cb;
187 26 ▶ $traverse_cb = sub {
Subroutine __ANON__: called CC=32 SCAR=34.7
188 26 my($ws, $obj) = @_;
189  
190 26 my $old_do_p = $do_p;
191 26 my $old_do_entities = $do_entities;
192  
193 26 my $obj_is_html_elt = &UNIVERSAL::isa($obj, 'Blatte::HTML::Element');
194  
195 26 ▶ my $obj_is__p = ($obj_is_html_elt && ($obj->name() eq '_p'));
Condition100%3/3
$obj_is_html_elt && $obj->name eq '_p'
!ll&&!rl&&r
1871
MC/DC100%2/2
$obj_is_html_elt && $obj->name eq '_p'
$obj_is_html_elt $obj->name eq '_p'
Truth table100%3/3
A && B
A= $obj_is_html_eltB= $obj->name eq '_p'
ABresult
0X0
100
111
196 26 ▶ my $obj_is__ent = ($obj_is_html_elt && ($obj->name() eq '_ent'));
Condition100%3/3
$obj_is_html_elt && $obj->name eq '_ent'
!ll&&!rl&&r
1871
MC/DC100%2/2
$obj_is_html_elt && $obj->name eq '_ent'
$obj_is_html_elt $obj->name eq '_ent'
Truth table100%3/3
A && B
A= $obj_is_html_eltB= $obj->name eq '_ent'
ABresult
0X0
100
111
197 26 ▶ my $obj_is_control = ($obj_is__p || $obj_is__ent);
Condition100%3/3
$obj_is__p || $obj_is__ent
l!l&&r!l&&!r
1124
MC/DC100%2/2
$obj_is__p || $obj_is__ent
$obj_is__p $obj_is__ent
Truth table100%3/3
A || B
A= $obj_is__pB= $obj_is__ent
ABresult
1X1
011
000
198  
199 26 ▶ if ($obj_is__p) {
Branch: 2 branches
BranchTrueFalseTotal
if ($obj_is__p) { } 1 25 26
elsif ($obj_is__ent) { } 1 24 25
200 1 $do_p = $obj->attrs();
201 } elsif ($obj_is__ent) {
202 1 $do_entities = $obj->attrs();
203 }
204  
205 26 ▶ my $obj_is_p = ($obj_is_html_elt && ($obj->name() eq 'p'));
Condition100%3/3
$obj_is_html_elt && $obj->name eq 'p'
!ll&&!rl&&r
1871
MC/DC100%2/2
$obj_is_html_elt && $obj->name eq 'p'
$obj_is_html_elt $obj->name eq 'p'
Truth table100%3/3
A && B
A= $obj_is_html_eltB= $obj->name eq 'p'
ABresult
0X0
100
111
206 26 ▶ my $newpar = ($do_p &&
Condition100%9/9
$do_p && ($obj_is_p || defined $ws && $ws =~ /\n.*\n/)
!ll&&!rl&&r
3185
$obj_is_p or defined $ws and $ws =~ /\n.*\n/
l!l&&r!l&&!r
1418
defined $ws and $ws =~ /\n.*\n/
!ll&&!rl&&r
5134
MC/DC100%4/4
$do_p && ($obj_is_p || defined $ws && $ws =~ /\n.*\n/)
$do_p $obj_is_p defined $ws $ws =~ /\n.*\n/
Truth table100%5/5
A && B or C and D
A= $do_pB= $obj_is_pC= defined $wsD= $ws =~ /\n.*\n/
ABCDresult
0XXX0
100X0
10100
11XX1
10111
207 ($obj_is_p || (defined($ws) && ($ws =~ /\n.*\n/))));
208  
209 26 my $close_needed;
210  
211 26 ▶ if ($newpar) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newpar) 5 21 26
212 5 ▶ for (my $i = $#stack; $i >= 0; --$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= 0) 3 4 7
213 3 my $elt = $stack[$i];
214 3 my $name = $elt->[0];
215 3 ▶ last if ($p_closure_barriers{$name});
Branch: 1 branch
BranchTrueFalseTotal
if $p_closure_barriers{$name} 0 3 3
216 3 ▶ if ($name eq 'p') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "p") 1 2 3
217 1 $close_needed = $i;
218 1 last;
219 }
220 }
221  
222 5 ▶ if (defined($close_needed)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $close_needed) 1 4 5
223 1 ▶ for (my $i = $#stack; $i >= $close_needed; --$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= $close_needed) 2 1 3
224 2 my $elt = $stack[$i];
225 2 my $name = $elt->[0];
226 2 &$render_cb("</$name>");
227 }
228  
229 1 ▶ splice(@stack, $close_needed, 1) if $obj_is_p;
Branch: 1 branch
BranchTrueFalseTotal
if $obj_is_p 0 1 1
230 }
231 }
232  
233 26 ▶ &$render_cb($ws) if defined($ws);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ws 20 6 26
234  
235 26 ▶ if ($newpar) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newpar) 5 21 26
236 5 ▶ if (defined($close_needed)) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $close_needed) { } 1 4 5
elsif (not $obj_is_p) { } 3 1 4
237 1 ▶ for (my $i = $close_needed; $i <= $#stack; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#stack) 2 1 3
238 2 my $elt = $stack[$i];
239 2 my($name, $tag) = @$elt;
240 2 &$render_cb($tag);
241 }
242 } elsif (!$obj_is_p) {
243 3 my $tag = '<p>';
244 3 &$render_cb($tag);
245 3 push(@stack, ['p', $tag]);
246 }
247 }
248  
249 26 ▶ if ($obj_is_html_elt) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj_is_html_elt) { } 8 18 26
250 8 my $tag;
251 my $name;
252  
253 8 ▶ unless ($obj_is_control) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj_is_control) 6 2 8
254 6 $tag = &make_start_tag($obj);
255 6 &$render_cb($tag);
256 6 $name = $obj->name();
257 }
258  
259 8 ▶ if ($obj_is_control || !$HTML::Tagset::emptyElement{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj_is_control or not $HTML::Tagset::emptyElement{$name}) 6 2 8
Condition100%3/3
$obj_is_control or not $HTML::Tagset::emptyElement{$name}
l!l&&r!l&&!r
242
MC/DC100%2/2
$obj_is_control or not $HTML::Tagset::emptyElement{$name}
$obj_is_control not $HTML::Tagset::emptyElement{$name}
Truth table100%3/3
A or not(B)
A= $obj_is_controlB= not $HTML::Tagset::emptyElement{$name}
ABresult
1X1
011
000
260 6 my $pair;
261  
262 6 ▶ unless ($obj_is_control) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj_is_control) 4 2 6
263 4 $pair = [$name, $tag];
264 4 push(@stack, $pair);
265 }
266  
267 6 &Blatte::traverse([$obj->content()], $traverse_cb);
268  
269 6 ▶ unless ($obj_is_control) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj_is_control) 4 2 6
270 4 ▶ for (my $i = $#stack; $i >= 0; --$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= 0) 5 0 5
271 5 my $elt = $stack[$i];
272 5 ▶ if ($elt eq $pair) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elt eq $pair) 4 1 5
273 4 ▶ for (my $j = $#stack; $j >= $i; --$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j >= $i) 5 4 9
274 5 my $elt2 = $stack[$j];
275 5 my $name2 = $elt2->[0];
276 5 &$render_cb("</$name2>");
277 }
278 4 splice(@stack, $i);
279 4 last;
280 }
281 }
282 }
283 }
284 } else {
285 18 ▶ &$render_cb($do_entities ? &encode_entities($obj) : $obj);
Branch: 1 branch
BranchTrueFalseTotal
$do_entities ? : 15 3 18
286 }
287  
288 26 $do_p = $old_do_p;
289 26 $do_entities = $old_do_entities;
290 10 };
291 10 &Blatte::traverse($val, $traverse_cb);
292 }
293  
294 3 1;
295  
296 __END__
↑ Summary