-
Notifications
You must be signed in to change notification settings - Fork 225
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
Lots of blank empty lines in output #22
Comments
@malkomalko Would you be able to share an example template showing this behaviour? |
Any if block adds an empty line even if it returns false, but I'll try to create something basic and post up as a test case. |
Closing due to inactivity, please re-open if there if a sample showing there is a bug in Stencil. |
I'm having a similar issue. Template
Context usedlet ctx = Context(dictionary: [
"images": ["GreenApple", "RedApple", "Pears"]
]) Actual outputenum Asset : String {
case GreenApple = "GreenApple"
case RedApple = "RedApple"
case Pears = "Pears"
} Expected outputenum Asset : String {
case GreenApple = "GreenApple"
case RedApple = "RedApple"
case Pears = "Pears"
} |
Writing a PR rn |
@kylef If you need more examples and tests, you can find plenty on the Before that commit is what I expected to have, after the commit is what I actually have (= the changes I did to make my tests pass until this issue is solved on Stencil) |
@kylef Here's a dirty workaround I use to fix that issue until we have better. I don't like it very much (feels like cheating) but at least it works in the meantime. |
Well, for now this works as expected (although we are talking about changing the behaviour). How it works now is not broken it's just how it was designed. You don't need to do those workarounds, instead you could control how the newlines are used in your templates. enum Suit { {% for suit in suits %}
case {{ suit }}{% endfor %}
} |
…and make unreadable templates, yeah 😄 I get your point, but the current behavior makes templates really hard to read and the new behavior would seem much more natural I think. So sure it's not a bug, but it's still a feature request 😉 |
Any there any updates on this? The solution that was discussed in #32 seems to be the right one. Preventing newlines when control flow blocks (eg. if and for) are on their own line |
I'd also love to see this feature! My templates have become unwieldy all too quickly. |
I've just implemented this in #85 |
Hi, Can we do something like jinja2 for Whitespace Control ? https://jinja.palletsprojects.com/en/master/templates/#whitespace-control Thanks |
@paulosilva There's a PR that adds this here #287 |
Can this be merged and closed? |
I have the same issue. Output contains a lot of blank lines. |
It appears if you use an if block, and it doesn't pass the truth test, it's still adding blank lines to the output. Have you found this to be correct?
The text was updated successfully, but these errors were encountered: