mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
commit
0511a43539
@ -7,6 +7,6 @@ require_once __DIR__.'/../tests/tools.php';
|
||||
|
||||
$fenom = Fenom::factory(__DIR__.'/templates', __DIR__.'/compiled');
|
||||
$fenom->setOptions(Fenom::AUTO_RELOAD);
|
||||
var_dump($fenom->compileCode('{$b == 5 ? "5" : "?"}')->getBody());
|
||||
var_dump($fenom->compileCode('{set $z = "A"~~"B"}')->getBody());
|
||||
//$fenom->display("blocks/second.tpl", []);
|
||||
// $fenom->getTemplate("problem.tpl");
|
@ -734,13 +734,15 @@ class Template extends Render
|
||||
if ($tokens->is(T_LNUMBER, T_DNUMBER)) {
|
||||
$concat[] = "strval(" . $this->parseTerm($tokens) . ")";
|
||||
} else {
|
||||
|
||||
if ($tokens->is('~')) {
|
||||
$tokens->next();
|
||||
$concat[] = " ";
|
||||
$concat[] = "' '";
|
||||
}
|
||||
if (!$concat[] = $this->parseTerm($tokens)) {
|
||||
if (!$term2 = "strval(".$this->parseTerm($tokens).")") {
|
||||
throw new UnexpectedTokenException($tokens);
|
||||
}
|
||||
$concat[] = $term2;
|
||||
}
|
||||
}
|
||||
$exp[] = "(" . implode(".", $concat) . ")";
|
||||
|
@ -1047,6 +1047,13 @@ class TemplateTest extends TestCase
|
||||
array('{"string" ~ "one" ~ "end"}', "stringoneend"),
|
||||
array('{"string" ~ 1 ~ "end"}', "string1end"),
|
||||
array('{$one ~= "string"} is {$one}', "1string is 1string"),
|
||||
|
||||
array('{"string" ~~ $one ~~ up("end")}', "string 1 END"),
|
||||
array('{"string" ~~ $one++ ~~ "end"}', "string 1 end"),
|
||||
array('{"string" ~~ ++$one ~~ "end"}', "string 2 end"),
|
||||
array('{"string" ~~ "one" ~~ "end"}', "string one end"),
|
||||
array('{"string" ~~ 1 ~~ "end"}', "string 1 end"),
|
||||
array('{$one ~= "string"} is {$one}', "1string is 1string"),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user