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

Remove redundant indentation inside Run block #78

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

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

I have fixed this issue, may be this will be useful for someone.

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

Successfully merging this pull request may close these issues.

None yet

1 participant