Index: includes/Parser.php =================================================================== --- includes/Parser.php (revision 24829) +++ includes/Parser.php (working copy) @@ -2017,7 +2017,7 @@ /* private */ function closeParagraph() { $result = ''; if ( '' != $this->mLastSection ) { - $result = 'mLastSection . ">\n"; + $result = 'mLastSection . '>'; } $this->mInPre = false; $this->mLastSection = ''; @@ -2042,47 +2042,47 @@ /* private */ function openList( $char ) { $result = $this->closeParagraph(); - if ( '*' == $char ) { $result .= ''; } - else if ( '#' == $char ) { $text = ''; } + if ( '*' == $char ) { $text = "\n"; } + else if ( '#' == $char ) { $text = "\n"; } else if ( ':' == $char ) { if ( $this->mDTopen ) { $this->mDTopen = false; - $text = ''; + $text = "\n"; } else { - $text = ''; + $text = "\n"; } } - else { return ''; } - return $text."\n"; + else { return "\n"; } + return $text; } /**#@-*/ @@ -2130,10 +2130,12 @@ $t = $oLine; } + $delim = ''; + # List generation if( $prefixLength && 0 == strcmp( $lastPrefix, $pref2 ) ) { # Same as the last item, so no need to deal with nesting or opening stuff - $output .= $this->nextItem( substr( $pref, -1 ) ); + $delim .= $this->nextItem( substr( $pref, -1 ) ); $paragraphStack = false; if ( substr( $pref, -1 ) == ';') { @@ -2144,7 +2146,7 @@ $term = $t2 = ''; if ($this->findColonNoLinks($t, $term, $t2) !== false) { $t = $t2; - $output .= $term . $this->nextItem( ':' ); + $delim .= $term . $this->nextItem( ':' ); } } } elseif( $prefixLength || $lastPrefixLength ) { @@ -2153,21 +2155,21 @@ $paragraphStack = false; while( $commonPrefixLength < $lastPrefixLength ) { - $output .= $this->closeList( $lastPrefix{$lastPrefixLength-1} ); + $delim .= $this->closeList( $lastPrefix{$lastPrefixLength-1} ); --$lastPrefixLength; } if ( $prefixLength <= $commonPrefixLength && $commonPrefixLength > 0 ) { - $output .= $this->nextItem( $pref{$commonPrefixLength-1} ); + $delim .= $this->nextItem( $pref{$commonPrefixLength-1} ); } while ( $prefixLength > $commonPrefixLength ) { $char = substr( $pref, $commonPrefixLength, 1 ); - $output .= $this->openList( $char ); + $delim .= $this->openList( $char ); if ( ';' == $char ) { # FIXME: This is dupe of code above if ($this->findColonNoLinks($t, $term, $t2) !== false) { $t = $t2; - $output .= $term . $this->nextItem( ':' ); + $delim .= $term . $this->nextItem( ':' ); } } ++$commonPrefixLength; @@ -2185,7 +2187,7 @@ if ( $openmatch or $closematch ) { $paragraphStack = false; # TODO bug 5718: paragraph closed - $output .= $this->closeParagraph(); + $delim .= $this->closeParagraph(); if ( $preOpenMatch and !$preCloseMatch ) { $this->mInPre = true; } @@ -2199,7 +2201,7 @@ // pre if ($this->mLastSection != 'pre') { $paragraphStack = false; - $output .= $this->closeParagraph().'
';
+							$delim .= $this->closeParagraph().'
';
 							$this->mLastSection = 'pre';
 						}
 						$t = substr( $t, 1 );
@@ -2207,25 +2209,25 @@
 						// paragraph
 						if ( '' == trim($t) ) {
 							if ( $paragraphStack ) {
-								$output .= $paragraphStack.'
'; + $delim .= $paragraphStack.'
'; $paragraphStack = false; $this->mLastSection = 'p'; } else { if ($this->mLastSection != 'p' ) { - $output .= $this->closeParagraph(); + $delim .= $this->closeParagraph(); $this->mLastSection = ''; $paragraphStack = '

'; } else { - $paragraphStack = '

'; + $paragraphStack = "

\n

"; } } } else { if ( $paragraphStack ) { - $output .= $paragraphStack; + $delim .= $paragraphStack; $paragraphStack = false; $this->mLastSection = 'p'; } else if ($this->mLastSection != 'p') { - $output .= $this->closeParagraph().'

'; + $delim .= $this->closeParagraph().'

'; $this->mLastSection = 'p'; } } @@ -2237,9 +2239,8 @@ if($preCloseMatch && $this->mInPre) { $this->mInPre = false; } - if ($paragraphStack === false) { - $output .= $t."\n"; - } + if ('' == $delim && '' == $paragraphStack) $delim = "\n"; + $output .= $delim . $t; } while ( $prefixLength ) { $output .= $this->closeList( $pref2{$prefixLength-1} );