Re: [SMARTY-DEV] outputfilter.trimwhitespace

From: Date: Sat, 25 Jan 2003 17:31:46 +0000
Subject: Re: [SMARTY-DEV] outputfilter.trimwhitespace
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-620@lists.php.net to get a copy of this message
added to CVS, thanks. Monte On Sat, 2003-01-25 at 07:44, Lars Noschinski wrote: > Hello! > > I made some changes to the trimwhitespace outputfilter: > > 1) Trim all leading whitespace to allow the output of correct X(HT)ML > documents. I've done this with an additional trim, as this seemed > easier for me than changing the regex. > > 2) Don't touch whitespace in textarea blocks, as they are also preformatted. > > Here's the diff against current cvs (r1.1): > > 33a34,39 > > // Pull out the script blocks > > preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, > > $match); > > $_textarea_blocks = $match[0]; > > $source = preg_replace("!<textarea[^>]+>.*?</textarea>!is", > > '@@@SMARTY:TRIM:TEXTAREA@@@', $source); > > > 36c42 > < $source = preg_replace('/((?<!\?>)\n)[\s]+/m', > '\1', $source); > --- > > $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', > > '\1', $source)); > 44a51,55 > > } > > > > // replace textarea blocks > > foreach($_textarea_blocks as $curr_block) { > > $source = > > preg_replace("!@@@SMARTY:TRIM:TEXTAREA@@@!",$curr_block,$source,1); -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.dev (#620) next »