You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.
It's unclear to me whether it's possible to comment out expressions and have handlebars.php completely ignore anything in a comment, which is possible in pretty much every programming language and commonly used for temporarily storing deleted code that may be fully or partially restored at a later time.
Currently, handlebars.php tries to parse any {{ }} it can find as an expression, including those within comments. This results in a fatal error when no helper can be found with that name.
That means I can't do this :
<!--<html> <body> Hello {{name}}</br> You have just won ${{value }}!</br> {{#in_ca}} Well, ${{taxed_value}}, after taxes.</br> {{/in_ca}} </body></html>-->
This also doesn't work :
{{!-- comment}}
<html><body>Hello {{name}}</br>
You have just won ${{value}}!</br>
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.</br>
{{/in_ca}}
</body></html>
{{comment --}}
This doesn't work either :
{{!--
<html><body>Hello {{name}}</br>
You have just won ${{value}}!</br>
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.</br>
{{/in_ca}}
</body></html>
--}}
Neither does this :
{{!-- <html><body>Hello {{name}}</br>You have just won ${{value}}!</br>{{#in_ca}}</br>Well, ${{taxed_value}}, after taxes.{{/in_ca}}</body></html> --}}
Whatever I try, I keep getting the following error :
<b>Fatal error</b>: Uncaught exception 'RuntimeException' with message 'in_ca is not registered as a helper' in /var/www/monitoring/Vendor/Handlebars/Template.php:349
Stack trace:
#0 /var/www/monitoring/Vendor/Handlebars/Template.php(404): Handlebars\Template->_mustacheStyleSection(Object(Handlebars\Context), Array)
#1 /var/www/monitoring/Vendor/Handlebars/Template.php(162): Handlebars\Template->_section(Object(Handlebars\Context), Array)
#2 /var/www/monitoring/Vendor/Handlebars/Handlebars.php(173): Handlebars\Template->render(Object(Application\View_Model))
#3 /var/www/monitoring/dashboard.php(46): Handlebars\Handlebars->render('<!DOCTYPE html>...', Object(Application\View_Model))
#4 {main}
thrown in <b>/var/www/monitoring/Vendor/Handlebars/Template.php</b> on line <b>349</b><br />
This isn't how I expect comments to work.
The text was updated successfully, but these errors were encountered:
@jslegers the original comments syntax is {{! This is a comment }}. Moreover a comment cannot contain closing stashes (}}).
In your last example anything after the first }} token is treated as a template, not as a comment. I think that you have not registered in_ca helper, that's why you've got an exception.
I believe that Handlebars.php behavior is correct and correspond to Handlebars.js behavior.
Handlebars.js allows comments that contain handlebar tokens with the {{!-- --}} syntax, and looks like that functionality has been there since at least 2013. Has this still not been implemented in Handlebars.php?
It's unclear to me whether it's possible to comment out expressions and have handlebars.php completely ignore anything in a comment, which is possible in pretty much every programming language and commonly used for temporarily storing deleted code that may be fully or partially restored at a later time.
Currently, handlebars.php tries to parse any
{{ }}
it can find as an expression, including those within comments. This results in a fatal error when no helper can be found with that name.That means I can't do this :
This also doesn't work :
This doesn't work either :
Neither does this :
Whatever I try, I keep getting the following error :
This isn't how I expect comments to work.
The text was updated successfully, but these errors were encountered: