lightncandy
Data:array(
"foo" => "World"
)
Template:Hello, {{foo}}.
{{=<* *>=}}Now, <*foo*>
Result:Hello, World.
Now, World
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Hello, {{foo}}.\n{{=<* *>=}}Now, <*foo*>";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "World"
);
echo $render($data);
handlebars.js
Template:Hello, {{foo}}.
{{=<* *>=}}Now, <*foo*>
Result:Parse error on line 2:
Hello, {{foo}}.{{=<* *>=}}Now, <*foo*
-----------------^
Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EQUALS'
Source Code
var Handlebars = require('handlebars');
var template = 'Hello, {{foo}}.\n{{=<* *>=}}Now, <*foo*>';
var render = Handlebars.compile(template);
var data = {
"foo": "World"
};
console.log(render(data));
mustache
Template:Hello, {{foo}}.
{{=<* *>=}}Now, <*foo*>
Result:Hello, World.
Now, World
Source Code
var Mustache = require('mustache');
var template = 'Hello, {{foo}}.\n{{=<* *>=}}Now, <*foo*>';
var data = {
"foo": "World"
};
console.log(Mustache.render(template, data));
lightncandy
Partials:
Data:array(
"foo" => "World"
)
Template:Hello, {{=[[ ]]=}}
[[> world]]
[[> bar]]
Result:Hello,
World!<<bar>>
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Hello, {{=[[ ]]=}}\n[[> world]]\n[[> bar]]";
$php = LightnCandy::compile($template, array(
"partials" => array(
"world" => "{{foo}}!",
"bar" => "<<bar>>"
)
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "World"
);
echo $render($data);
handlebars.js
Partials:
Template:Hello, {{=[[ ]]=}}
[[> world]]
[[> bar]]
Result:Parse error on line 1:
Hello, {{=[[ ]]=}}[[> world]
---------^
Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EQUALS'
Source Code
var Handlebars = require('handlebars');
var template = 'Hello, {{=[[ ]]=}}\n[[> world]]\n[[> bar]]';
var render = Handlebars.compile(template);
var data = {
"foo": "World"
};
console.log(render(data, {
partials: {
"world": "{{foo}}!",
"bar": "<<bar>>"
}}));
mustache
Partials:
Template:Hello, {{=[[ ]]=}}
[[> world]]
[[> bar]]
Result:Hello,
World!<<bar>>
Source Code
var Mustache = require('mustache');
var template = 'Hello, {{=[[ ]]=}}\n[[> world]]\n[[> bar]]';
var data = {
"foo": "World"
};
console.log(Mustache.render(template, data, {
"world": "{{foo}}!",
"bar": "<<bar>>"
}));