Fix #6204 : only unindent toc if we indented it previously.
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 3 May 2007 19:36:24 +0000 (19:36 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 3 May 2007 19:36:24 +0000 (19:36 +0000)
RELEASE-NOTES
includes/Parser.php

index 10e6e80..21d0bda 100644 (file)
@@ -31,6 +31,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi
 * (bug 9670) Follow redirects when render edit section links to transcluded
   templates.
+* (bug 6204) Fix incorrect unindentation with $wgMaxTocLevel
 
 == Maintenance script changes since 1.10 ==
 
index c4396c2..0ef3d2b 100644 (file)
@@ -3536,7 +3536,12 @@ class Parser
                                                }
                                        }
                                        if( $toclevel<$wgMaxTocLevel ) {
-                                               $toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
+                                               if($prevtoclevel < $wgMaxTocLevel) {
+                                                       # Unindent only if the previous toc level was shown :p
+                                                       $toc .= $sk->tocUnindent( $prevtoclevel - $toclevel );
+                                               } else {
+                                                       $toc .= $sk->tocLineEnd();
+                                               }
                                        }
                                }
                                else {