-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Trim all but 1 whitespace jinja condition #671
Comments
I'm on board with all that, including the proposed operator. |
Ok, then I'll make a PR soon. :) |
I like that! For readability I'd like it best if a run of whitespaces becomes a single '\n' if it contains an '\n', or a space otherwise. |
I'm fine with implementing it this way. Anyone else has an opinion maybe? |
Yeah, I think that approach makes sense. |
I'd love, if it is also configurable like #664. So you can configure it through the config file or part of the |
Sure. What should we name the config parameter then? |
Also, if both "trim_all" and "trim_all_but_one" are enabled, what should we do? |
Maybe instead of having them be individual. Maybe it might be possible to do |
Maybe @djc was right: I should have gone with a string argument for "trim_whitespace" so then we wouldn't have this problem. EDIT: @vallentin Ah we reached the same conclusion haha. |
Yup! |
Ok, then I'll change the parameter as well. :) |
Well, there hasn't been a new release yet. So it's not to late to play with it :) |
I think the names should be |
I think a mix between @djc's and @vallentin's propositions would work better. What do you think of:
? |
I still dislike anything "trim" because that's not, conceptually, what it is. We're either suppressing the whitespace from the template or preserving it, and this option is somewhere in between. To my eyes, I do like the idea of just calling it |
That makes sense. Then let's go with |
@vallentin suggested here that we could extend the "trim_all_whitespace" feature to be able to trim all whitespace characters but one.
So currently, we have:
Which will remove all whitespace characters before and after (by using
-
) and we have:Which means that the whitespace should be saved (only useful when the "trim all whitespace" feature is enabled).
The idea would now to add a new character to strip all whitespace characters but one. I propose
~
:The text was updated successfully, but these errors were encountered: