Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redundant indentation inside Run block #76

Open
alshabalin opened this issue Feb 25, 2015 · 0 comments
Open

Redundant indentation inside Run block #76

alshabalin opened this issue Feb 25, 2015 · 0 comments

Comments

@alshabalin
Copy link

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 :)

@alshabalin alshabalin changed the title Redunandant indentation inside Run block Redundant indentation inside Run block Feb 25, 2015
alshabalin added a commit to alshabalin/MtHaml that referenced this issue Feb 25, 2015
To the issue arnaud-lb#76 "Redundant indentation inside Run block"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant