Revert mystery change r41983 -- no explanation of the change or its purpose.
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 12 Oct 2008 23:14:39 +0000 (23:14 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 12 Oct 2008 23:14:39 +0000 (23:14 +0000)
Appears to be an attempt to remove some extra whitespace, but it's kind of unclear.

includes/parser/Parser.php
maintenance/parserTests.txt

index c1c18a8..d951a02 100644 (file)
@@ -4190,20 +4190,23 @@ class Parser
                */
                $nl = array_key_exists( 'compact', $param ) ? '' : "\n";
   
-               $replacer = new DoubleReplacer( ' ', '&nbsp;' );
-               $text = $this->recursiveTagParse( $in );
-               $text = $this->mStripState->unstripNoWiki( $text );
+               $tag = $this->insertStripItem( "<br />", $this->mStripState );
                // Only strip the very first and very last \n (which trim cannot do)
-               if( substr( $text, 0, 1 ) == "\n" )
-                       $text = substr( $text, 1 );
+               $text = $in;
+               if( substr( $in, 0, 1 ) == "\n" )
+                       $text = substr( $in, 1 );
                if( substr( $text, -1 ) == "\n" )
                        $text = substr( $text, 0, -1 );
                
-               $text = str_replace( "\n", "<br />\n", $text );
+               $text = str_replace( "\n", "$tag\n", $text );
                $text = preg_replace_callback(
                        "/^( +)/m",
-                       $replacer->cb(),
+                       create_function(
+                               '$matches',
+                               'return str_replace(" ", "&nbsp;", "$matches[0]");'
+                       ),
                        $text );
+               $text = $this->recursiveTagParse( $text );
 
                // Pass HTML attributes through to the output.
                $attribs = Sanitizer::validateTagAttributes( $param, 'div' );
@@ -4215,7 +4218,7 @@ class Parser
                        $attribs['class'] = 'poem';
                }
 
-               return Xml::openElement( 'div', $attribs ) . $nl . trim( $text ) . $nl . Xml::closeElement( 'div' );
+               return XML::openElement( 'div', $attribs ) . $nl . trim( $text ) . $nl . XML::closeElement( 'div' );
        }
 
        function getImageParams( $handler ) {
index 5f5f54f..20876f2 100644 (file)
@@ -7234,7 +7234,9 @@ test
 this<br />
 is<br />
 a<br />
-test</p>
+test<br />
+
+</p>
 </div>
 
 !!end
@@ -7254,7 +7256,9 @@ test
 this<br />
 '''is'''<br />
 a<br />
-test</p>
+test<br />
+
+</p>
 </div>
 
 !! end