From 5e2a46dc2435528bdf4154816492581402d0f13e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 1 Dec 2005 23:51:16 +0000 Subject: [PATCH] * Make smarter about whitespace --- includes/Parser.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 8747b09bfe..40aa81e8fb 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2508,10 +2508,10 @@ class Parser # If there are any tags, only include them if ( in_string( '', $text ) && in_string( '', $text ) ) { - preg_match_all( '/(.*?)<\/onlyinclude>/s', $text, $m ); + preg_match_all( '/(.*?)<\/onlyinclude>\n?/s', $text, $m ); $text = ''; foreach ($m[1] as $piece) - $text .= $this->trimOnlyinclude( $piece ); + $text .= $piece; } # Remove sections and tags $text = preg_replace( '/.*?<\/noinclude>/s', '', $text ); @@ -2589,19 +2589,6 @@ class Parser } } - /** - * Trim the first and last newlines of a string, this is not equivalent - * to trim( $str, "\n" ) which would trim them all. - * - * @param string $str The string to trim - * @return string - */ - function trimOnlyinclude( $str ) { - $str = preg_replace( "/^\n/", '', $str ); - $str = preg_replace( "/\n$/", '', $str ); - return $str; - } - /** * Translude an interwiki link. */ -- 2.20.1