-
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
parser: add optional {% endwhen %}
#165
Conversation
rinja_parser/src/node.rs
Outdated
let comment = Comment { | ||
ws: Ws(pws, nws), | ||
content: "", | ||
}; | ||
Node::Comment(WithSpan::new(comment, span)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation is kinda lazy, that I add a "virtual" comment node. But I guess it's good enough for the foreseeable future. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment on this code so future us won't wonder why there is a comment generated here. 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe, yeah, makes sense to write comments in a place where you would actually find them. :D
book/src/template_syntax.md
Outdated
@@ -619,6 +619,11 @@ You can also match against multiple alternative patterns at once: | |||
{% endmatch %} | |||
``` | |||
|
|||
For better interoperability with linters and auto-formatters like [djLint], | |||
you can also use a optional `{% endwhen %}` node to close a `{% when %}` case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
7655077
to
d3c3a63
Compare
d3c3a63
to
f1d4c1b
Compare
Thank you for putting in the work on this @Kijewski! To be honest, I am unfamiliar with It is very small and insignificant for most, but every time I need to manually format something I feel it take a chunk of my soul. It is much appreciated |
I think we had the same question before in askama, but I cannot find the issue. Even though I don't use djLint or similar linters, I can see how this feature can be useful to people that do.
Resolves #163.
Cc @chrisp60.