Index: trunk/phase3/includes/Parser.php |
— | — | @@ -3453,17 +3453,13 @@ |
3454 | 3454 | $enoughToc = true; |
3455 | 3455 | } |
3456 | 3456 | |
3457 | | - # Never ever show TOC if no headers |
3458 | | - if( $numMatches < 1 ) { |
3459 | | - $enoughToc = false; |
3460 | | - } |
3461 | | - |
3462 | 3457 | # We need this to perform operations on the HTML |
3463 | 3458 | $sk = $this->mOptions->getSkin(); |
3464 | 3459 | |
3465 | 3460 | # headline counter |
3466 | 3461 | $headlineCount = 0; |
3467 | 3462 | $sectionCount = 0; # headlineCount excluding template sections |
| 3463 | + $numVisible = 0; |
3468 | 3464 | |
3469 | 3465 | # Ugh .. the TOC should have neat indentation levels which can be |
3470 | 3466 | # passed to the skin functions. These are determined here |
— | — | @@ -3493,7 +3489,6 @@ |
3494 | 3490 | |
3495 | 3491 | if( $toclevel ) { |
3496 | 3492 | $prevlevel = $level; |
3497 | | - $prevtoclevel = $toclevel; |
3498 | 3493 | } |
3499 | 3494 | $level = $matches[1][$headlineCount]; |
3500 | 3495 | |
— | — | @@ -3504,7 +3499,9 @@ |
3505 | 3500 | $toclevel++; |
3506 | 3501 | $sublevelCount[$toclevel] = 0; |
3507 | 3502 | if( $toclevel<$wgMaxTocLevel ) { |
| 3503 | + $prevtoclevel = $toclevel; |
3508 | 3504 | $toc .= $sk->tocIndent(); |
| 3505 | + $numVisible++; |
3509 | 3506 | } |
3510 | 3507 | } |
3511 | 3508 | elseif ( $level < $prevlevel && $toclevel > 1 ) { |
— | — | @@ -3611,9 +3608,14 @@ |
3612 | 3609 | $sectionCount++; |
3613 | 3610 | } |
3614 | 3611 | |
| 3612 | + # Never ever show TOC if no headers |
| 3613 | + if( $numVisible < 1 ) { |
| 3614 | + $enoughToc = false; |
| 3615 | + } |
| 3616 | + |
3615 | 3617 | if( $enoughToc ) { |
3616 | | - if( $toclevel<$wgMaxTocLevel ) { |
3617 | | - $toc .= $sk->tocUnindent( $toclevel - 1 ); |
| 3618 | + if( $prevtoclevel > 0 && $prevtoclevel < $wgMaxTocLevel ) { |
| 3619 | + $toc .= $sk->tocUnindent( $prevtoclevel - 1 ); |
3618 | 3620 | } |
3619 | 3621 | $toc = $sk->tocList( $toc ); |
3620 | 3622 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -365,7 +365,12 @@ |
366 | 366 | * (bug 8602) Converted Special:Contributions to use an IndexPager. The |
367 | 367 | interpretation of the offset parameter has changed, and the go parameter |
368 | 368 | has been removed. |
| 369 | +* (bug 6204) Fixes for indentation with $wgMaxTocLevel: |
| 370 | + - don't emit too many list close tags after an invisible header |
| 371 | + - don't emit too many final list close tags if last header is invisible |
| 372 | + - don't emit TOC when there are no visible headers |
369 | 373 | |
| 374 | + |
370 | 375 | == Maintenance == |
371 | 376 | |
372 | 377 | * New script maintenance/language/checkExtensioni18n.php used to check i18n |