Skip to content

Commit 1bd4e25

Browse files
committed
Merge pull request leafo#64 from robocoder/formatter
formatter should format()
2 parents ce0584c + 100e9c8 commit 1bd4e25

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scss.inc.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ function compile($code, $name=null) {
8686

8787
$this->compileRoot($tree);
8888

89-
ob_start();
90-
$this->formatter->block($this->scope);
91-
$out = ob_get_clean();
89+
$out = $this->formatter->format($this->scope);
9290

9391
setlocale(LC_NUMERIC, $locale);
9492
return $out;
@@ -3865,7 +3863,7 @@ public function property($name, $value) {
38653863
return $name . $this->assignSeparator . $value . ";";
38663864
}
38673865

3868-
public function block($block) {
3866+
protected function block($block) {
38693867
if (empty($block->lines) && empty($block->children)) return;
38703868

38713869
$inner = $pre = $this->indentStr();
@@ -3896,6 +3894,14 @@ public function block($block) {
38963894
echo $pre . $this->close . $this->break;
38973895
}
38983896
}
3897+
3898+
public function format($block) {
3899+
ob_start();
3900+
$this->block($block);
3901+
$out = ob_get_clean();
3902+
3903+
return $out;
3904+
}
38993905
}
39003906

39013907
/**
@@ -3943,7 +3949,7 @@ public function adjustAllChildren($block) {
39433949
}
39443950
}
39453951

3946-
public function block($block) {
3952+
protected function block($block) {
39473953
if ($block->type == "root") {
39483954
$this->adjustAllChildren($block);
39493955
}

0 commit comments

Comments
 (0)