newLine at end of @this(...) and @(...) are not part of content #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is quite a simple fix and I am wondering why this wasn't addressed yet.
If you have a template that defines a constructor or takes arguments you will always have a newLine in front of your rendered content. People are complaining about this behaviour e.g here and I have seen other comments where people complain about the newLine behaviour of various twirl expressions. This PR fixes a (small) part of that complains.
E.g. given following template:
currently renders to the following two lines
But actually it should be just one line, without the new line
The same happens when you use
this(...)
IMHO the newLine at the end of
this(...)
and@()
should not be seens as part of the template. These two lines just define the constructor and the arguments for the render method, but have nothing to do with the content.Eventually my fix will also remove a lot of newLines for many people because usually you template call other templates that call other templates ... etc. so you will end up with many ugly new lines no one needs or wants.
All my pr does is calling
check("\n")
after the argument lists which swallows a new line if there is one.