nette / latte

☕ Latte: the safest & truly intuitive templates for PHP. Engine for those who want the most secure PHP sites.
https://latte.nette.org
Other
1.13k stars 109 forks source link

Printing data - when start with space will not output / print the data correctly #330

Closed ampmonteiro closed 1 year ago

ampmonteiro commented 1 year ago

Version: 3.0.5

Bug Description

when i am printing a variable or a result of function will not output correctly the data or even apply filters, when start with space.

Steps To Reproduce


<p>{ $var}</p>

<p>{ $var|upper}</p>

lattefield

image

Expected Behavior

Like others template engine or even on php when using short print way, it will display even when start with a space

Possible Solution

Some how should be trimmed before being processed.

mabar commented 1 year ago

This is actually documented behavior https://latte.nette.org/en/syntax#toc-tags

If the { character is followed by a quote or space, Latte doesn't consider it to be the beginning of a tag, so you can use JavaScript constructs, JSON, or CSS rules in your templates without any problems.