Skip to content

Commit

Permalink
fix partial block standalone detection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zordius committed Mar 17, 2018
1 parent f89bb23 commit 9615b44
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ protected static function token(&$token, &$context) {

if ($partials) {
$context['stack'] = array_slice($context['stack'], 0, -4);
static::spacing($token, $context);
$context['currentToken'][Token::POS_LOTHER] = '';
$context['currentToken'][Token::POS_LSPACE] = '';
return;
Expand Down
36 changes: 36 additions & 0 deletions tests/regressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,42 @@ public function issueProvider()
'expected' => "3'r'd"
),

Array(
'id' => 289,
'template' => "1\n2\n{{~foo~}}\n3",
'data' => array('foo' => 'OK'),
'expected' => "1\n2OK3"
),

Array(
'id' => 289,
'template' => "1\n2\n{{#test}}\n3TEST\n{{/test}}\n4",
'data' => array('test' => 1),
'options' => Array(
'flags' => LightnCandy::FLAG_RUNTIMEPARTIAL
),
'expected' => "1\n2\n3TEST\n4"
),

Array(
'id' => 289,
'template' => "1\n2\n{{~#test}}\n3TEST\n{{/test}}\n4",
'data' => array('test' => 1),
'options' => Array(
'flags' => LightnCandy::FLAG_RUNTIMEPARTIAL
),
'expected' => "1\n23TEST\n4"
),

Array(
'id' => 289,
'template' => "1\n2\n{{#>test}}\n3TEST\n{{/test}}\n4",
'options' => Array(
'flags' => LightnCandy::FLAG_RUNTIMEPARTIAL
),
'expected' => "1\n2\n3TEST\n4"
),

Array(
'id' => 290,
'template' => '{{foo}} }} OK',
Expand Down

0 comments on commit 9615b44

Please sign in to comment.