Handlebars: Extended Comment

If you wanna include }} inside your comment, you can use extended comment: {{!-- comments allow }} inside it --}}

This is a handlebars.js extension, mustache do not support this.

Samples

}} can not be placed inside a comment.

lightncandy
Data:
NULL
Template:
Comment: {{! comment with }} is not ok }}
Result:
Comment:  is not ok }}
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Comment: {{! comment with }} is not ok }}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data);
handlebars.js
Data:
Template:
Comment: {{! comment with }} is not ok }}
Result:
Comment:  is not ok }}
Source Code
var Handlebars = require('handlebars');
var template = 'Comment: {{! comment with }} is not ok }}';

var render = Handlebars.compile(template);
var data = undefined;
console.log(render(data));

}} can be placed inside an extended comment.

lightncandy
Data:
NULL
Template:
Comment: {{!-- comment with }} is ok --}}
Result:
Comment: 
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Comment: {{!-- comment with }} is ok --}}";

$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = NULL;
echo $render($data);
handlebars.js
Data:
Template:
Comment: {{!-- comment with }} is ok --}}
Result:
Comment: 
Source Code
var Handlebars = require('handlebars');
var template = 'Comment: {{!-- comment with }} is ok --}}';

var render = Handlebars.compile(template);
var data = undefined;
console.log(render(data));

See Also...