-
Notifications
You must be signed in to change notification settings - Fork 13
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
Implement whitespace control #8
Comments
it seems to be the same with the statement end token %}. |
This is by design, in order to match Jinja2's default behavior, as described here. Advanced whitespace control has not been implemented yet, with the exception of dashes to manually remove whitespace (the Eventually, I would of course want this to be configurable as options to the parser, however I have limited time on my hands, and this is not very high on my priority list right now. Accepting the |
Implement whitespace control as described in http://jinja.pocoo.org/docs/2.9/templates/#whitespace-control:
|
Thanks for the explanation. Now I understand why ginger works like this.
generates
In my situation I use ginger to generate haskell and hamlet code for yesod apps. Currently I always have to append a space (' ') at the end of lines which end with }} or %}. This is a totally ugly workaround. Being able to use 'keep_trailing_newline' would save my day. |
e35dd23 adds a |
1df5568 changes trailing newline behavior to match Jinja: only |
thanks for the quick change. It seems that even with 'poKeepTrailingNewline = False' keeps the newline too. So it is contrary to the jinja2 default, that you mentioned. |
I found another issue: produces this: but it should keep the newline in front of '(2nd inc line)' |
Hmm, I followed the jinja2 documentation here, which only talks about blocks,
Ah, this might be an actual bug. I'll move it to a separate issue if you don't |
template:
Hello, {{ name }},\nwelcome in {{ location|upper }}!
result:
Hello, Alice,
welcome in WONDERLAND!
but if in the first line the variable is the last thing on the line, then the \n is removed:
template:
Hello, {{ name }}\nwelcome in {{ location|upper }}!
result:
Hello, Alicewelcome in WONDERLAND!
is this a bug? Or Do I need another syntax for the variable closing token?
Alex.
The text was updated successfully, but these errors were encountered: