I use Python 3.4 + Django 1.7.1 with Eclipse - PyDev and I use AcroEdit to edit HTML.
I think AcroEdit uses two soft spaces for indent.
I made a custom template tag named custom_tag in custom_tag_library.py like:
# -*- coding: utf-8 -*-
from django import template
from _ast import Num
register = template.Library()
@register.inclusion_tag('custom_tag.html')
def custom_tag(content):
return {'content': content, 'children': content.children.all()}
and for custom_tag.html:
{% load custom_tag_library %}
<div class = 'a'>
{{ content.name }}
{% if children %}
<div class = 'b'>
{% for child in children %}
{% custom_tag child %}
{% endfor %}
</div>
{% endif %}
</div>
(As you can see, content object has name and children)
So, custom_tag is a recursive tag gives a tree structure represented in <div> hierarchy.
But when I use this, the output HTML has many spaces and empty lines like this:

I tried {% spaceless %} {% endspaceless %}, but it doesn't work.
I think this appears because I use indents to increase readability for my codes. But I want to maintain my coding style about the indentation.
How can I fix this?