[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17207: 24.3; html-mode incorrect indentation inside template syntax
From: |
Stefan Kangas |
Subject: |
bug#17207: 24.3; html-mode incorrect indentation inside template syntax |
Date: |
Sun, 03 Nov 2019 14:20:45 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Jon Dufresne <jon.dufresne@gmail.com> writes:
> Create a test.html file. Use html-mode. Fill with the following
> contents:
>
> ```
> <table>
> <thead>
> <tr>
> {% for header in headers %}
> <th>{{ header.attr1 }}</th>
> <th>{{ header.attr2 }}</th>
> {% endfor %}
> </tr>
> </thead>
> </table>
> ```
>
> This is a mix of HTML and Django template syntax [0]. If you indent line
> 6 (<th>{{ header.attr2 }}</th>) I would expect the line to align itself
> with the previous line (<th>{{ header.attr1 }}</th>). Instead it appears
> to aligns itself with the "for" template tag or perhaps the <tr> plus an
> offset. The final result after indenting line 6 is as it appears above.
>
> The mode pony-tpl-mode [1] uses html-mode to calculate indentation when
> then previous line looks like HTML and not special syntax. See my bug
> report there: https://github.com/davidmiller/pony-mode/issues/81
>
> [0] https://docs.djangoproject.com/en/dev/topics/templates/
> [1] https://github.com/davidmiller/pony-mode
This was reported 5 years ago, but unfortunately never got a reply at
the time.
I can reproduce this on current master, but I wonder if it makes sense
to make html-mode support Django template syntax. Shouldn't there be
a separate (perhaps derived) mode for that?
Best regards,
Stefan Kangas
- bug#17207: 24.3; html-mode incorrect indentation inside template syntax,
Stefan Kangas <=