arnaud-lb / MtHaml

Multi target HAML (HAML for PHP, Twig, <your language here>)
Other
359 stars 54 forks source link

Twig: Missing endblock in empty block #50

Closed muja closed 10 years ago

muja commented 10 years ago
- block content

renders to

{% block content %}

instead of

{% block content %}
{% endblock %}

This works however:

- block content
  Hi

renders to

{% block content %}
  Hi
{% endblock %}

Workaround:

- block content
- endblock
vendethiel commented 10 years ago

Dup of an old ticket. Use - block content ""

arnaud-lb commented 10 years ago

In HAML, the end of a "block" is denoted by a undent. If there is no indent, there is no undent, so no closing tag :)

The solution is to use a variant that doesn't need a closing tag (e.g. {% content "" %}), or to make sure that the tag has a content.

muja commented 10 years ago

Okay, but how come a single .block is rendered with a closing tag to <div class="block"></div>

arnaud-lb commented 10 years ago

HTML tags are handled differently; HAML knows how HTML is supposed to work, however it knows nothing about the scripting language (Twig in this case).