Skip to content

Commit

Permalink
Remove redundant indentation inside Run block
Browse files Browse the repository at this point in the history
To the issue arnaud-lb#76 "Redundant indentation inside Run block"
  • Loading branch information
alshabalin committed Feb 25, 2015
1 parent d90f6e2 commit 71b4fe0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/MtHaml/NodeVisitor/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ public function enterTopBlock(Run $node)

if (!$node->isBlock()) {
if (preg_match('~[:;]\s*$~', $content)) {
$this->write(sprintf('<?php %s ?>' , $content));
$this->write(sprintf('<?php %s ?>' , $content), true);
} else {
$this->write(sprintf('<?php %s; ?>' , $content));
$this->write(sprintf('<?php %s; ?>' , $content), true);
}
} else {
$this->write(sprintf('<?php %s { ?>' , $content));
$this->write(sprintf('<?php %s { ?>' , $content), true);
$this->undent();
}
}

Expand All @@ -111,13 +112,14 @@ public function enterMidBlock(Run $node)

$content = $this->trimInlineComments($node->getContent());

$this->write(sprintf('<?php } %s { ?>' , $content));
$this->write(sprintf('<?php } %s { ?>' , $content), true);
}

public function leaveTopBlock(Run $node)
{
if ($node->isBlock()) {
$this->write('<?php } ?>');
$this->write('<?php } ?>', true);
$this->indent();
}
}

Expand Down

0 comments on commit 71b4fe0

Please sign in to comment.