Skip to content
This repository

Template indentation is wrong when there are multiple tags on a line #51

Open
gareth-rees opened this Issue March 30, 2012 · 1 comment

2 participants

Gareth Rees David Miller
Gareth Rees

Open the following template in pony-tpl-mode:

<img>
{% block foo %}{% endblock %}
<img>

and indent the whole file (C-x h C-M-\). The result is as follows:

<img>
{% block foo %}{% endblock %}
  <img>

with the second <img> incorrectly indented. This is because pony-calculate-indent-backward recognizes that the {% block foo %} starts an indented block but does not recognize that the {% endblock %} closes that block.

The indentation calculation needs to look at all tags on a line, not just the first tag.

David Miller
Owner

Thoughts:

I can't recreate this issue when I paste your example into a new template.

I end up with all three lines without an indent - running from the latest Pony Mode master, Emacs 23.

e.g.

<img>
{% block foo %}{% endblock %}
<img>

Which is the "Right Thing" AFAIC

I added a test for this - if you run

$ rake test

... from the root of the repo on a local checkout you should see four passing tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.