Redundant indentation inside Run block
alshabalin opened this issue · comments
Alexei Shabalin commented
Suppose we have the following template:
%body
- $options = [ 'One', 'Two', 'Three', 'Four', 'Five' ]
- if (count($options))
%ul
- foreach ($options as $item)
%li= $item
- else
%div No options!
Now it generates well-indented PHP code like this:
<body>
<?php $options = [ 'One', 'Two', 'Three', 'Four', 'Five' ]; ?>
<?php if (count($options)) { ?>
<ul>
<?php foreach ($options as $item) { ?>
<li><?php echo htmlspecialchars($item,ENT_QUOTES,'UTF-8'); ?></li>
<?php } ?>
</ul>
<?php } else { ?>
<div>No options!</div>
<?php } ?>
</body>
But in fact the output HTML code has some redundant indentation:
<body>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
</ul>
</body>
It would be nice to have something like this:
<body>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
</ul>
</body>
This HTML code is much more pretty :)