Skip to content
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

Detect, and fix, template tags broken over multiple lines #98

Open
jarshwah opened this issue Oct 31, 2024 · 3 comments
Open

Detect, and fix, template tags broken over multiple lines #98

jarshwah opened this issue Oct 31, 2024 · 3 comments

Comments

@jarshwah
Copy link

Description

Template tags that are broken over multiple lines are rendered as text by DTL:

{% tagname ...
%}  <-- uh, oh! closed on a different line

It's a source of many innocuous bugs. Is this something that could be detected and fixed by djade?

@EmilStenstrom
Copy link

This is patched to work across many projects and some libraries (including django-components), so I suggest not applying this to avoid errors either way.

@adamchainz
Copy link
Owner

Yes, also there's ongoing work to add support for this to Django: https://forum.djangoproject.com/t/allow-newlines-inside-tags/36040

But a lint rule could be useful. I actually filed a duplicate the day after @jarshwah : #99.

@meshy
Copy link

meshy commented Dec 20, 2024

This is a nice idea. It'd be great if this could detect accidental multi-line tags, and fix them.

A word of caution, though: until Django supports multi-line tags, automatic fixes should be opt-in, to make sure formatting doesn't accidentally change the semantics of a file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants