-
Notifications
You must be signed in to change notification settings - Fork 25
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
Document jinja_custom_elements_names #25
Comments
Hey @di 👋 thank you for taking the time to research this and write a detailed report. I’ve intentionally left I think I need more time working on the parser to have an informed opinion of whether this is a good API or not. In the meantime, if people are using this already anyway, it probably does make sense to take the time to document this, even if it did end up changing. In keeping with every other setting, I’ll probably also add a CLI flag for this. For performance issues, yes, the parser’s performance is rather poor, I think because of it being based on combinators / recursion. Here I suspect it’d iterate through the letters in |
I'd agree that it's not the greatest API -- specifically the need to provide tuples of elements is a bit confusing if you don't understand how the parser works. That said, being able to add custom elements is a requirement for me to use this library, so I've gone ahead and used An alternative would be for this library to be able to pick up on the elements that extensions are providing as well, but I feel like that's probably asking a lot! |
Done! This is still not the best API possible, but it’s now officially supported as of v0.13.0. I renamed the option to Note I’ve kept Edit: forgot to mention, another change is that there is some basic validation in place that the setting has the expected data structure (list of lists). |
Thank you! |
Is your proposal related to a problem?
I tried using curlylint on a project that uses Jinja's i18n extension. Without configuring or changing anything, I would get failures like this:
I couldn't find any documentation about configuring support for custom elements.
In order to get this to work, I had to a) read the source code to determine if this was possible b) add the following to my
pyproject.toml
:Describe the solution you’d like
Ideally
jinja_custom_elements_names
would be documented / officially supported. The format (a list of lists) should also be explained -- it seems that order is important.Additional context
I also discovered that with a sufficiently large directory of templates, naively adding a string instead of a list, e.g.:
would result in a significant (exponential?) increase in runtime, and should probably be guarded against.
The text was updated successfully, but these errors were encountered: