mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-03-23 17:01:23 +03:00
fixes extra escaping of scalar arguments
This commit is contained in:
parent
d92640890f
commit
93b6dd8cb6
@ -57,6 +57,8 @@ class Tokenizer
|
||||
const T_UNESCAPED_2 = '&';
|
||||
const T_TEXT = '_t';
|
||||
const T_ESCAPE = "\\";
|
||||
const T_SINGLE_Q = "'";
|
||||
const T_DOUBLE_Q = "\"";
|
||||
|
||||
// Valid token types
|
||||
private static $_tagTypes = array(
|
||||
@ -127,7 +129,7 @@ class Tokenizer
|
||||
|
||||
$this->escaping = $this->tagChange(self::T_ESCAPE, $text, $i);
|
||||
|
||||
if ( $this->escaped and $text[$i] != self::T_UNESCAPED ) {
|
||||
if ( $this->escaped and !in_array($text[$i], array(self::T_UNESCAPED, self::T_SINGLE_Q, self::T_DOUBLE_Q)) ) {
|
||||
$this->buffer .= "\\";
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
return implode(' ', $parsed_args);
|
||||
});
|
||||
$this->assertEquals('a \"b\" c', $engine->render('{{argsTest "a" "\"b\"" \'c\'}}', array()));
|
||||
$this->assertEquals("a \"b\" c", $engine->render('{{{argsTest "a" "\"b\"" \'c\'}}}', array()));
|
||||
}
|
||||
|
||||
public function testInvalidHelperMustacheStyle()
|
||||
|
Loading…
Reference in New Issue
Block a user