r50289 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50288‎ | r50289 | r50290 >
Date:23:21, 6 May 2009
Author:aboostani
Status:deferred
Tags:
Comment:
Fixed a minor problem with $wgSectionContainers that was causing some divs to not be closed properly
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3682,7 +3682,7 @@
36833683 if( !empty( $head[$i] ) ) { # if there's no next header, then don't try to close out any existing sections here
36843684 # get the level of the next header section
36853685 preg_match('/<H([0-6])/i', $head[$i], $hLevelMatches);
3686 -
 3686+
36873687 if ( count($hLevelMatches) > 0 ) {
36883688 $hLevel = $hLevelMatches[1];
36893689 if ( $i != 0 ) { # we don't have an open div for section 0, so don't try to close it
@@ -3701,7 +3701,7 @@
37023702
37033703 # if we've outputed the last section of the article, close any open divs that are remaining
37043704 if ( $i == ( count($blocks) - 1) && isset($currentHLevel) ) {
3705 - $this->closeSectionContainers( $hLevel, $currentHLevel, $full, $openDivs);
 3705+ $this->closeSectionContainers( $hLevel, $currentHLevel, $full, $openDivs, true);
37063706 }
37073707 }
37083708
@@ -3727,8 +3727,8 @@
37283728 * @param array $openDivs a reference to the array that stores a list of open section containers
37293729 * @return true
37303730 */
3731 - function closeSectionContainers( $hLevel, &$currentHLevel, &$full, &$openDivs) {
3732 - while ( $hLevel <= $currentHLevel ) {
 3731+ function closeSectionContainers( $hLevel, &$currentHLevel, &$full, &$openDivs, $lastCall=false) {
 3732+ while ( $hLevel <= $currentHLevel || $lastCall) {
37333733 $full .= '</div>';
37343734 $popped = array_pop($openDivs);
37353735 if ( count($openDivs) ) {

Status & tagging log