Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"keep whitespace" mode #11

Open
bwaidelich opened this issue Aug 30, 2018 · 5 comments
Open

"keep whitespace" mode #11

bwaidelich opened this issue Aug 30, 2018 · 5 comments

Comments

@bwaidelich
Copy link
Member

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
Copy link
Member Author

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
Copy link
Member

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
Copy link
Member

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
Copy link

$fusion = 'Neos.Fusion:Array {' . PHP_EOL;

seems to be the correct location

@bwaidelich
Copy link
Member Author

seems to be the correct location

This is the right one IIRC:

$astNode['payload'] = preg_replace('/[\\s]*\\n[\\s]*/u', '', $astNode['payload']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants