Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

[FIX] trimwhitespace

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
Magoli
Smarty n00b


Joined: 23 Mar 2014
Posts: 1

PostPosted: Sun Mar 23, 2014 12:43 pm    Post subject: [FIX] trimwhitespace Reply with quote

In file: smarty/plugins/outputfilter.trimwhitespace.php

After:
Code:
    // Unify Line-Breaks to \n
    $source = preg_replace("/\015\012|\015|\012/", "\t", $source);

Add a:
Code:
   $source = preg_replace('/\t/', ' ', $source);
   $source = preg_replace('/ +/', ' ', $source);

This patch fixes tabs, and much space turning into one.


Optional change this line:
Code:
    // Unify Line-Breaks to \n
    $source = preg_replace("/\015\012|\015|\012/", "\t", $source);

To:
Code:
    // Output in a single line
    $source = preg_replace("/\015\012|\015|\012/", "", $source);
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Apr 04, 2014 10:59 pm    Post subject: Reply with quote

Note that the function of the trimwhitespace filter is to remove unnecessary whitespaces from and between HTML markup tags which might have been added for formatting reasons in source.

It does not remove whitespaces within plain text or assigned variables.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP