From 28a9ea2b1cf3a428437d9608defee101acb5e287 Mon Sep 17 00:00:00 2001 From: Arash Boostani Date: Tue, 19 May 2009 15:12:05 +0000 Subject: [PATCH] Reverting the code that encloses article sections in their own div for the time being, because there are certain scenarios that break the document structure. --- includes/DefaultSettings.php | 9 +----- includes/parser/Parser.php | 57 +----------------------------------- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 34106840e1..f1b5f68acf 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3817,11 +3817,4 @@ $wgInvalidUsernameCharacters = '@'; * $wgInvalidUsernameCharacters above, or you will not be able to * modify the user rights of those users via Special:UserRights */ -$wgUserrightsInterwikiDelimiter = '@'; - -/** - * The $wgSectionContainers variable is used by the parser to determine if it should - * wrap each section of an article in a div. It is automatically enabled if the EditSectionHiliteLink - * extension is installed. - */ -$wgSectionContainers = false; \ No newline at end of file +$wgUserrightsInterwikiDelimiter = '@'; \ No newline at end of file diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 7ff348b8cf..782d00159c 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3371,7 +3371,7 @@ class Parser * @private */ function formatHeadings( $text, $isMain=true ) { - global $wgMaxTocLevel, $wgContLang, $wgEnforceHtmlIds, $wgSectionContainers; + global $wgMaxTocLevel, $wgContLang, $wgEnforceHtmlIds; $doNumberHeadings = $this->mOptions->getNumberHeadings(); $showEditLink = $this->mOptions->getEditSection(); @@ -3657,10 +3657,6 @@ class Parser $blocks = preg_split( '/.*?<\/H[1-6]>/i', $text ); $i = 0; - - if ( $wgSectionContainers ) { - $openDivs = array(); - } foreach( $blocks as $block ) { if( $showEditLink && $headlineCount > 0 && $i == 0 && $block !== "\n" ) { @@ -3676,34 +3672,6 @@ class Parser # Top anchor now in skin $full = $full.$toc; } - - # wrap each section in a div if $wgSectionContainers is set to true - if ( $wgSectionContainers ) { - if( !empty( $head[$i] ) ) { # if there's no next header, then don't try to close out any existing sections here - # get the level of the next header section - preg_match('/ 0 ) { - $hLevel = $hLevelMatches[1]; - if ( $i != 0 ) { # we don't have an open div for section 0, so don't try to close it - # close any open divs for sections with headers that are <= to the next header level - $this->closeSectionContainers( $hLevel, $currentHLevel, $full, $openDivs); - } - $currentHLevel = $hLevel; - } - } - - # open the div for the next header, if there is one - if ( isset($currentHLevel) && !empty( $head[$i] ) ) { - $full .= '
'; - array_push($openDivs, array($currentHLevel, $i)); - } - - # if we've outputed the last section of the article, close any open divs that are remaining - if ( $i == ( count($blocks) - 1) && isset($currentHLevel) ) { - $this->closeSectionContainers( $hLevel, $currentHLevel, $full, $openDivs, true); - } - } if( !empty( $head[$i] ) ) { $full .= $head[$i]; @@ -3716,29 +3684,6 @@ class Parser return $full; } } - - /** - * Analyze the header level of the current and next section being parsed to - * determine if any already parsed sections need to be closed - * - * @param string $hLevel the level of the next header to be parsed - * @param string $currentHLevel the level of the last parsed header - * @param string $full a reference to the string that stores the output of the parser - * @param array $openDivs a reference to the array that stores a list of open section containers - * @return true - */ - function closeSectionContainers( $hLevel, &$currentHLevel, &$full, &$openDivs, $lastCall=false) { - while ( $hLevel <= $currentHLevel || $lastCall) { - $full .= '
'; - $popped = array_pop($openDivs); - if ( count($openDivs) ) { - $currentHLevel = $openDivs[count($openDivs) - 1][0]; - } else { - break; - } - } - return true; - } /** * Transform wiki markup when saving a page by doing \r\n -> \n -- 2.20.1