Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jan 8, 2017
2 parents 5777bc8 + 634c7dd commit db01b01
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
],
"require": {
"php": ">=5.3.0",
"js-phpize/js-phpize": "^1.0"
"js-phpize/js-phpize": "^1.2"
},
"require-dev": {
"phpunit/phpunit": ">=4.0",
Expand Down
5 changes: 4 additions & 1 deletion src/Jade/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public function compile($node)
$code = ltrim(implode('', $this->buffer));
if ($this->jsPhpize) {
$dependencies = $this->jsPhpize->compileDependencies();
$code = $this->createCode($dependencies) . $code;
if (!empty($dependencies)) {
$this->jsPhpize->flushDependencies();
$code = $this->createCode($dependencies) . $code;
}
}

if ($this->phpSingleLine) {
Expand Down
21 changes: 21 additions & 0 deletions tests/features/issues.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,25 @@ public function testSymfonyIssue6()
// style as array
$this->assertSame($expected, $actual);
}

public function testIssue100()
{
$pug = new Pug(array(
'expressionLanguage' => 'js',
));
$actual = trim($pug->render('p Example #{item.name} #{helpers.format(\'money\', item.price)}', array(
'item' => array(
'name' => 'Foo',
'price' => 12,
),
'helpers' => array(
'format' => function ($type, $price) {
return $type . '-' . $price;
},
),
)));
$expected = '<p>Example Foo money-12</p>';

$this->assertSame($expected, $actual);
}
}

0 comments on commit db01b01

Please sign in to comment.