Giter VIP home page Giter VIP logo

Comments (4)

thibaudcolas avatar thibaudcolas commented on July 18, 2024

Hey @di 👋 thank you for taking the time to research this and write a detailed report. I’ve intentionally left jinja_custom_elements_names undocumented because it comes straight from jinjalint, on which curlylint is based, and I’ve been unable to decide whether I liked this as an API to extend the parser or not. I usually try to take quite good care not to unnecessarily break things that are documented on a project, and was intending to potentially change how this is configured, hence why it’s been left out.

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 trans and attempt to generate parsers for {% t %}, {% r %}, etc. I’ll see whether something can be done in this particular case – am also interested in using JSON Schema to both document and validate all of the configuration, but that’s probably for another day.

from curlylint.

di avatar di commented on July 18, 2024

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 jinja_custom_elements_names even though it's undocumented. 🙂

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!

from curlylint.

thibaudcolas avatar thibaudcolas commented on July 18, 2024

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 template_tags in config files, or --template-tags via the CLI.

Note I’ve kept jinja_custom_elements_names for now for backwards compatibility, and in all likelihood it’ll stay around for a while, but I’ll remove it in a future release once people have had a chance to switch over to the supported setting.

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).

from curlylint.

di avatar di commented on July 18, 2024

Thank you!

from curlylint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.