X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/3f27a9733660c811c6b8d640ddadbd811979e24c..6c546c8f3182668c6d21d578b789674894f18c39:/IkiWiki/Plugin/map.pm?ds=inline

diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 6567331fa..4a9bf58db 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -103,7 +103,7 @@ sub preprocess (@) {
 			$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--;
 		}
@@ -120,7 +120,7 @@ sub preprocess (@) {
 		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);
@@ -154,6 +154,8 @@ sub preprocess (@) {
 		$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;
 }