This re-fixes the same bug as
2d5c2f30, but without introducing
malformed HTML in some situations. This is not a very elegant
solution, but it has the advantage of passing more tests.
$addparent="";
$map .= ($spaces x $indent) . "</li>\n";
if ($indent > 1) {
- $map .= ($spaces x $indent) . "</ul>\n";
+ $map .= ($spaces x $indent) . "</ul><map:collapse>\n";
}
$indent--;
}
while ($depth > $indent) {
$indent++;
if ($indent > 1) {
- $map .= ($spaces x $indent) . "<ul>\n";
+ $map .= ($spaces x $indent) . "<ul><map:collapse>\n";
}
if ($depth > $indent) {
$p.="/".shift(@bits);
$indent--;
$map .= ($spaces x $indent) . "</ul>\n";
}
+ $map =~ s{\n *</ul><map:collapse>\n *<ul><map:collapse>\n}{\n}gs;
+ $map =~ s{<map:collapse>}{}g;
$map .= "</div>\n";
return $map;
}