A comment begin with!
and will be ignored. For example: {{! this is a comment}}
array(
"foo" => "OK"
)
Ya!
Ya!
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{#foo}}Ya!{{! ignored this comment}}{{/foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "OK"
);
echo $render($data);
{
"foo": "OK"
}
Ya!
Ya!
var Handlebars = require('handlebars');
var template = '{{#foo}}Ya!{{! ignored this comment}}{{/foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "OK"
};
console.log(render(data));
{
"foo": "OK"
}
Ya!
Ya!
var Mustache = require('mustache');
var template = '{{#foo}}Ya!{{! ignored this comment}}{{/foo}}';
var data = {
"foo": "OK"
};
console.log(Mustache.render(template, data));
array(
"foo" => true
)
Yes
No
Yes
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{#foo}}Yes{{! foo is true}}{{/foo}}\n{{^foo}}No{{! foo is false}}{{/foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => true
);
echo $render($data);
{
"foo": true
}
Yes
No
Yes
var Handlebars = require('handlebars');
var template = '{{#foo}}Yes{{! foo is true}}{{/foo}}\n{{^foo}}No{{! foo is false}}{{/foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": true
};
console.log(render(data));
{
"foo": true
}
Yes
No
Yes
var Mustache = require('mustache');
var template = '{{#foo}}Yes{{! foo is true}}{{/foo}}\n{{^foo}}No{{! foo is false}}{{/foo}}';
var data = {
"foo": true
};
console.log(Mustache.render(template, data));
}}
can not be placed inside a comment.NULL
Comment example:
is not ok }}
Comment example: is not ok }}
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Comment example: {{! comment with }} is not ok }}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data);
Comment example:
is not ok }}
Comment example: is not ok }}
var Handlebars = require('handlebars');
var template = 'Comment example: {{! comment with }} is not ok }}';
var render = Handlebars.compile(template);
var data = undefined;
console.log(render(data));
Comment example:
is not ok }}
Comment example: is not ok }}
var Mustache = require('mustache');
var template = 'Comment example: {{! comment with }} is not ok }}';
var data = undefined;
console.log(Mustache.render(template, data));