<div {{w.attrs | xmlattr }}>
    <a href="#" class="subdocuments-add" onclick="return (function(btn) { var el=btn.parentNode.lastChild; while(el.nodeType !== 1) { el = el.previousSibling; } el.style.display = 'block'; return false; })(this)">Add</a>
    {% for c in w.children %}
     {% if not loop.last %}
      <a href="#" class="subdocuments-delete" onclick="return (function(btn) { var el=btn.nextSibling; while(el.nodeType !== 1) { el = el.nextSibling; } if (el) { el.remove(); btn.remove(); } return false; })(this)"></a>
     {% endif %}
     {{c.display()}}
     {% if w.separator and not loop.last %}{{w.separator|safe}}{% endif %}
    {% endfor %}
</div>
