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
Could you also support jinja templates? #22
Comments
Thank you for the excellent suggestion! I've had a quick browse through https://jinja.palletsprojects.com/templates/ and if I'm not mistaken, DjHTML currently already supports all of the main constructs in Jinja templates. In particular, the doc's opening example is rendered correctly by DjHTML: <!DOCTYPE html>
<html lang="en">
<head>
<title>My Webpage</title>
</head>
<body>
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
<h1>My Webpage</h1>
{{ a_variable }}
{# a comment #}
</body>
</html> What Jinja syntax would still need to be implemented in DjHTML for full Jinja2 support? |
There might be some good examples here? https://github.com/justrhysism/prettier-plugin-nunjucks/tree/master/tests I'm not sure if those would be in scope of this project but still might be worth looking into :-) You can also state the support for Jinja2 (and maybe Twig/Nunjucks?) in README, if you do want to support it. And of course, thank you so much for this project! This is something long awaited by the Jinja2 user community in particular. |
I have updated the documentation to explicitly announce Jinja2 support! I will close this issue now, but if you (or any other Jinja user) has any issues regarding the processing of Jinja2 templates, let it be known that you are more than welcome to open new issues! 🤗 |
This is great, thank you. |
Really nice to see this, thank you! Some other things to consider in the future:
|
Previously, `{# ... #}` comments were only recognized if they were opened and closed on the same line. This commit allows them to span multiple lines. As with the other comment tags, anything inside is ignored. Thanks to @notpushkin for pointing this out! Ref. #22
Thanks for building this, its been on my wish list for a while.
I think it wouldn't be too hard to support Jinja2 templates as well (I think the syntax is very similar), would this be something you are willing to do?
The text was updated successfully, but these errors were encountered: