Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5725
diff2
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:38 PM
2014-11-21 22:38:06 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
diff2
View Options
Index: includes/parser/Parser.php
===================================================================
--- includes/parser/Parser.php (revision 51213)
+++ includes/parser/Parser.php (working copy)
@@ -3477,23 +3477,19 @@
elseif ( $level < $prevlevel && $toclevel > 1 ) {
# Decrease TOC level, find level to jump to
- if ( $toclevel == 2 && $level <= $levelCount[1] ) {
- # Can only go down to level 1
- $toclevel = 1;
- } else {
- for ($i = $toclevel; $i > 0; $i--) {
- if ( $levelCount[$i] == $level ) {
- # Found last matching level
- $toclevel = $i;
- break;
- }
- elseif ( $levelCount[$i] < $level ) {
- # Found first matching level below current level
- $toclevel = $i + 1;
- break;
- }
+ for ($i = $toclevel; $i > 0; $i--) {
+ if ( $levelCount[$i] == $level ) {
+ # Found last matching level
+ $toclevel = $i;
+ break;
}
+ elseif ( $levelCount[$i] < $level ) {
+ # Found first matching level below current level
+ $toclevel = $i + 1;
+ break;
+ }
}
+ if( $i == 0 ) $toclevel = 1;
if( $toclevel<$wgMaxTocLevel ) {
if($prevtoclevel < $wgMaxTocLevel) {
# Unindent only if the previous toc level was shown :p
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5275
Default Alt Text
diff2 (1 KB)
Attached To
Mode
T21017: TOC level calculation error in an odd case
Attached
Detach File
Event Timeline
Log In to Comment