-
Notifications
You must be signed in to change notification settings - Fork 14
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
syntax for closing a {% when ... %}
block within a match
#163
Comments
I think the |
I am pretty sure you just mispoke but to be clear, I am arguing for the But, yeah I do agree that more syntax kind of sucks. I am purely in the "it definitely shouldn't be mandatory, but it would be nice to optionally have". Then again, optional syntax can become a PITA to maintain alongside other changes. In any case, I don't mind having a fork for a while to gauge if anyone else feels strongly about it. Thanks for being open to it at least! |
Jetlag and reading on mobile. So yes, I meant Making it optional could be a nice improvement though. |
Hey! I have enjoyed using this project and am unsure if anything like this would be possible.
The long and the short of it is that most constructs in the syntax have both a
{% something %}
and an{% endsomething %}
, this is not the case for match (when) arms.I understand why this is, and agree it should be the default. But, a lot of html templating tools (formatters in particular) work best when each block has a start and end.
This is a simplified example of the current syntax. Formatted with djlint, a common and widely used jinja formatter.
formatter settings
Notice how the content of the
when
arms in on the same indentation level as thewhen
itself. Some people may want it that way, and it should be the default.Proposed
What I am suggesting, would be to optionally allow closing
when
arms.This is produced by the same formatter, with slightly different settings.
formatter settings
Notice how there is now a clear difference in indenation levels. AFAIK, no formatter for html/jinja templates allows this type of template to be configured for, because it can't know where it ends.
I know the difference is minimal, I know it is not really the crates job to worry about stuff like this. But, I think even semantically, it does make sense for the user to have the ability to specifically close a when arm, even if proc macro just throws it away.
I am willing to write the PR for this, if open to the change
The text was updated successfully, but these errors were encountered: