neos / fusion-afx

[READ-ONLY] JSX inspired compact syntax for Neos.Fusion
GNU General Public License v3.0
25 stars 9 forks source link

"keep whitespace" mode #11

Open bwaidelich opened 6 years ago

bwaidelich commented 6 years ago

As documented AFX strips whitespaces and newlines and this makes a lot of sense usually.

But sometimes it can be useful or even required to keep the whitespaces, for example when using AFX for email templates, code generators or code snippets.

For those it would be nice to have some kind of "keep whitespace" mode, for example:

emailTemplate = afxkws`
Hello {props.name},

foo bar baz
`
bwaidelich commented 6 years ago

It seems as it's just this one line that removes the whitespaces: https://github.com/neos/fusion-afx/blob/master/Classes/Service/AfxService.php#L182

So it should be fairly easy to implement this

kdambekalns commented 3 years ago

The linked issue neos/neos-development-collection#3331 has another example for "regular website content", this is not limited to "exotic" code or mail rendering…

kdambekalns commented 3 years ago

It seems as it's just this one line that removes the whitespaces: https://github.com/neos/fusion-afx/blob/master/Classes/Service/AfxService.php#L182

@bwaidelich Is that line still the correct one? The link points to master, not a specific revision, and the code has changed since August 2018…

creative-resort commented 3 years ago

https://github.com/neos/fusion-afx/blob/3774d2fd70769cc3448255d3dd52ff0b663fe811/Classes/Service/AfxService.php#L327 seems to be the correct location

bwaidelich commented 6 months ago

seems to be the correct location

This is the right one IIRC: https://github.com/neos/fusion-afx/blob/3774d2fd70769cc3448255d3dd52ff0b663fe811/Classes/Service/AfxService.php#L306