Page MenuHomePhabricator

TOC level calculation error in an odd case
Closed, ResolvedPublic

Description

Minimal patch against r51213 to fix the bug

The code that lays out the TOC corrects non-continuous sequences, for example a level-2 heading followed by a level-4. In looking over that code to answer a question as to how exactly that works, I found a bug in an odd case.

This wikitext:
=== A ===
==== B ====
===== C =====
== D ==

Generates this TOC layout:
1 A

1.1 B
    1.1.1 C
    1.1.2 D

By any logic, it should do this instead:
1 A

1.1 B
    1.1.1 C

2 D

The attached patch fixes this. This probably makes the special case for $toclevel == 2 && $level <= $levelCount[1] obsolete too, I'll attach that patch momentarily.


Version: 1.16.x
Severity: enhancement

Attached:

Details

Reference
bz19017

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:38 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz19017.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 6173
Patch against r51213 to fix the bug and remove the obsolete conditional

Attached: