-
-
Notifications
You must be signed in to change notification settings - Fork 113
Add indent filter #151
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
Add indent filter #151
Conversation
The indent filter in Jinja2 does not indent the first line by default. Unclear if this is good behavior, but this means that the filters behave differently between the two engines. For me this is almost an argument to add this filter into an extension package with additional filters. |
Thank you for your reply. Maybe I could match the behavior of my Code to Jinja2s behavior (see https://jinja.palletsprojects.com/en/3.0.x/templates/#jinja-filters.indent). It seems like, they solved this, by adding some more arguments. I'll also remove the possibility of using tabs instead of spaces in favor of this. Unfortunately, rust is not good in keyword-based parameters (see rust-lang/rfcs#323), so the implementation could be very unintuitive. Would that path of action still be OK with you? I'll also try to create an extension-package with filters, that don't try to math the behavior. There, I could create many separate indent-functions, depending on the current need. I hope, I can already dig into this, because it is very new to me. It should give us more flexibility, and I love this proposal. I will open a separate PR for this. Should I create an Issue for that? |
For what it’s worth, MiniJinja has basic support for keyword arguments. If a filter is invoked with If you want send the PR against this here, and before merging I move it into a separate package. |
Thank you for your support. I'll explore the keyword support. For now, I pushed my changed, so others can follow my progress. I change the PR title to WIP |
I also noticed, that my use of feature messed with my tests, and they were never executed. My code will need much more refactoring. |
removed feature, because it sould be builtin for jinja2
I think, I can hand the code over for review. |
Thank you for everything. |
I missed a feature where i can ident a multiline Value. This PR should fix it.
Please be patient with me, this is my second PR and I'm new to Rust. I will do my best if something is missing.