map: postprocess to collapse useless </ul><ul> sequences
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.
master
parent
12ca01fd5c
commit
af8712cfac
|
@ -103,7 +103,7 @@ sub preprocess (@) {
|
||||||
$addparent="";
|
$addparent="";
|
||||||
$map .= ($spaces x $indent) . "</li>\n";
|
$map .= ($spaces x $indent) . "</li>\n";
|
||||||
if ($indent > 1) {
|
if ($indent > 1) {
|
||||||
$map .= ($spaces x $indent) . "</ul>\n";
|
$map .= ($spaces x $indent) . "</ul><map:collapse>\n";
|
||||||
}
|
}
|
||||||
$indent--;
|
$indent--;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ sub preprocess (@) {
|
||||||
while ($depth > $indent) {
|
while ($depth > $indent) {
|
||||||
$indent++;
|
$indent++;
|
||||||
if ($indent > 1) {
|
if ($indent > 1) {
|
||||||
$map .= ($spaces x $indent) . "<ul>\n";
|
$map .= ($spaces x $indent) . "<ul><map:collapse>\n";
|
||||||
}
|
}
|
||||||
if ($depth > $indent) {
|
if ($depth > $indent) {
|
||||||
$p.="/".shift(@bits);
|
$p.="/".shift(@bits);
|
||||||
|
@ -154,6 +154,8 @@ sub preprocess (@) {
|
||||||
$indent--;
|
$indent--;
|
||||||
$map .= ($spaces x $indent) . "</ul>\n";
|
$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";
|
$map .= "</div>\n";
|
||||||
return $map;
|
return $map;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue