mindplay-dk / php-outline

Legacy template engine archived here for historical purposes
1 stars 0 forks source link

parse_attributes only splits with " " #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
$compiler->escape_split only splits with " ".

So the script will not recognize the second input if you do something like 
this:
{{testfunction var1=11
var2=22}}

If you have many input variables, it can be confusing if you have to write 
them all in a single line.
It would be better to include also the new line characters when splitting.

Original issue reported on code.google.com by oppenlaender@gmail.com on 14 Apr 2010 at 4:03

GoogleCodeExporter commented 9 years ago
I'm not actively developing version 1 at the moment, so it could be a while 
before this 
enhancement makes it in.

If you'd like to attempt to add this enhancement yourself, you're welcome to 
post a 
patch or corrected method here.

Original comment by rasmus.m...@gmail.com on 15 Apr 2010 at 11:46

GoogleCodeExporter commented 9 years ago
I tried to fix it today, but it seems there will have to be widespread changes 
made in 
two of the classes. :-(

Original comment by oppenlaender@gmail.com on 4 May 2010 at 12:02

GoogleCodeExporter commented 9 years ago
Adding this to the escape_split() method in compiler.php right after the line 
that 
starts with
$bit = '';
should fix the problem, I believe:

    //replace new line characters and tabs with " "
    //also remove multiple " "
    $str = preg_replace('~\r\n|\r|\n|\t|[\s]+~', " ", $str);

There's other splits both in compiler.php and system.php. They refer to the 
blank 
space after the first keyword. I will probably have to replace those explode 
functions with a regex, too.

Original comment by oppenlaender@gmail.com on 4 May 2010 at 7:18

GoogleCodeExporter commented 9 years ago

Original comment by rasmus.m...@gmail.com on 7 May 2010 at 2:44