experimental fix to the template-inserts-newline-on-save problem
authorGabriel Wicke <gwicke@users.mediawiki.org>
Sun, 2 May 2004 23:18:25 +0000 (23:18 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Sun, 2 May 2004 23:18:25 +0000 (23:18 +0000)
includes/Parser.php

index 1f28f5c..cd1469b 100644 (file)
@@ -1468,7 +1468,7 @@ class Parser
                if ( !$found ) {
                        return $matches[0];
                } else {
-                       return $newline . $text;
+                       return $text;
                }
        }
 
@@ -1515,7 +1515,7 @@ class Parser
                $htmlattrs = $this->getHTMLattrs () ;
 
                # Remove HTML comments
-               $text = preg_replace( "/\n?<!--.*-->\n?/sU", "", $text );
+               $text = preg_replace( "/(\n *<!--.*--> *(?=\n)|<!--.*-->)/sU", "$2", $text );
 
                $bits = explode( "<", $text );
                $text = array_shift( $bits );