http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72336
Revision: 72336 Author: conrad Date: 2010-09-04 00:03:45 +0000 (Sat, 04 Sep 2010) Log Message: ----------- Bug 6204 - TOC not properly rendered when using $wgMaxTocLevel Credit for mini-patch to Brandon Ooi Modified Paths: -------------- trunk/phase3/RELEASE-NOTES trunk/phase3/includes/parser/Parser.php trunk/phase3/maintenance/parserTests.txt Modified: trunk/phase3/RELEASE-NOTES =================================================================== --- trunk/phase3/RELEASE-NOTES 2010-09-04 00:01:30 UTC (rev 72335) +++ trunk/phase3/RELEASE-NOTES 2010-09-04 00:03:45 UTC (rev 72336) @@ -311,6 +311,7 @@ * (bug 24981) Allow extensions to access SpecialUpload variables again * (bug 20744) Wiki forgets about an uploaded file * (bug 17913) Don't show "older edit" when no older edit available +* (bug 6204) TOC not properly rendered when using $wgMaxTocLevel === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent. Modified: trunk/phase3/includes/parser/Parser.php =================================================================== --- trunk/phase3/includes/parser/Parser.php 2010-09-04 00:01:30 UTC (rev 72335) +++ trunk/phase3/includes/parser/Parser.php 2010-09-04 00:03:45 UTC (rev 72336) @@ -3782,7 +3782,6 @@ if ( $toclevel ) { $prevlevel = $level; - $prevtoclevel = $toclevel; } $level = $matches[1][$headlineCount]; Modified: trunk/phase3/maintenance/parserTests.txt =================================================================== --- trunk/phase3/maintenance/parserTests.txt 2010-09-04 00:01:30 UTC (rev 72335) +++ trunk/phase3/maintenance/parserTests.txt 2010-09-04 00:03:45 UTC (rev 72336) @@ -3874,6 +3874,36 @@ !! end !! test +TOC with wgMaxTocLevel=3 and two level four headings (bug 6204) +!! options +wgMaxTocLevel=3 +!! input +==Section 1== +===Section 1.1=== +====Section 1.1.1==== +====Section 1.1.1.1==== +==Section 2== +!! result +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> +<ul> +<li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a> +<ul> +<li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li> +</ul> +</li> +<li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li> +</ul> +</td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script> +<h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2> +<h3><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3> +<h4><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4> +<h4><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4> +<h2><span class="editsection">[<a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2> + +!! end + + +!! test Resolving duplicate section names !! input == Foo bar == _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs