trivago / prettier-plugin-twig-melody

Code formatting plugin for Prettier which can handle Twig/Melody templates
Apache License 2.0
155 stars 35 forks source link

Shorthand block statement is changed into invalid block statement #61

Open andersaloof opened 4 years ago

andersaloof commented 4 years ago

When formating a shorthand or empty block statement, eg.:

{% block content '' %}
{% block content "foobar" %}

The code is changed to:

{% block content  %}
{% block content foobar %}

This results in Twig throwing a syntax error when rendering the empty statement:

Twig Syntax Error – Twig\Error\SyntaxError
Unexpected token "end of template" ("end of statement block" expected).

Or this error for the string statement

Twig Runtime Error – Twig\Error\RuntimeError
Variable "foobar" does not exist.