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

Newline not preserved after tag when using line whitespace trimming #3162

Closed
ericmorand opened this issue Sep 25, 2019 · 6 comments
Closed

Comments

@ericmorand
Copy link
Contributor

Consider the following template:

{% do 1 + 2 ~%}
    foo

When rendered, we get:

    foo

https://twigfiddle.com/oxixzf

But according to the documentation:

Line whitespace trimming via the ~ modifier: Removes all whitespace (excluding newlines). Using this modifier on the right disables the default removal of the first newline inherited from PHP.

Shouldn't the newline after the do tag be preserved?

@stof
Copy link
Member

stof commented Sep 26, 2019

The compiled template (which can be displayed on twigfiddle) shows that it is rendering a newline char. So this might actually be an issue of Twigfiddle itself not support an output starting with a newline char, or something like that.

@stof
Copy link
Member

stof commented Sep 26, 2019

See https://twigfiddle.com/0nw355 for a fiddle having the same issue in the rendered output, while there is definitely a newline char being rendered.

@ericmorand
Copy link
Contributor Author

Oh, thanks. I should have checked with TwigPHP itself.

@stof
Copy link
Member

stof commented Sep 26, 2019

Well, twigfiddle is a nice tool, but it might have bugs too. I reported it there

@ericmorand
Copy link
Contributor Author

Yes, thanks for that. The "Show raw result" button is quite confusing to me. Very nice tool though but I'll double-check with my local TwigPHP environment in the future.

@ninsuo
Copy link
Contributor

ninsuo commented Sep 26, 2019

Hi there,

Sorry about that guys, will fix the tool soon.

Cheers,
Alain

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

No branches or pull requests

3 participants