Skip to content

Commit

Permalink
Merge pull request #64 from robocoder/formatter
Browse files Browse the repository at this point in the history
formatter should format()
  • Loading branch information
leafo committed Mar 29, 2013
2 parents ce0584c + 100e9c8 commit 1bd4e25
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scss.inc.php
Expand Up @@ -86,9 +86,7 @@ function compile($code, $name=null) {

$this->compileRoot($tree);

ob_start();
$this->formatter->block($this->scope);
$out = ob_get_clean();
$out = $this->formatter->format($this->scope);

setlocale(LC_NUMERIC, $locale);
return $out;
Expand Down Expand Up @@ -3865,7 +3863,7 @@ public function property($name, $value) {
return $name . $this->assignSeparator . $value . ";";
}

public function block($block) {
protected function block($block) {
if (empty($block->lines) && empty($block->children)) return;

$inner = $pre = $this->indentStr();
Expand Down Expand Up @@ -3896,6 +3894,14 @@ public function block($block) {
echo $pre . $this->close . $this->break;
}
}

public function format($block) {
ob_start();
$this->block($block);
$out = ob_get_clean();

return $out;
}
}

/**
Expand Down Expand Up @@ -3943,7 +3949,7 @@ public function adjustAllChildren($block) {
}
}

public function block($block) {
protected function block($block) {
if ($block->type == "root") {
$this->adjustAllChildren($block);
}
Expand Down

0 comments on commit 1bd4e25

Please sign in to comment.