-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing Delimiter #350
Comments
Unfortunately Handlebars uses a generated parser so it is impossible to change the delimiter at runtime. You could possibly build a custom build of Handlebars by modifying the lexer (https://github.com/wycats/handlebars.js/blob/master/src/handlebars.l) to replace all usages of |
(I mentioned this in another issue, but just in case someone stumbles onto this one) I put this module together to make it easy to use custom delims if anyone is interested. suggestions for improvement or prs are welcome |
@jonschlinkert this is a very fragile workaround (it cannot reliably deal with curly braces in the template code). This modified version of your example:
throws at template compile time. |
Who knew a hack could be fragile ;P any time you have a workaround that is only useful in specific scenarios it will necessarily be fragile in every other scenario. That, and who wants to spend the time to do much more than that? IMO if you need different delimiters for something important, it just makes more sense to use a different engine. Do you have suggestions for a better alternative? Sent from my iPhone
|
So, I guess you effectively demonstrated that it is not that easy to create a clean, robust solution to this problem. While I don't quite agree with you that it makes more sense to use a different engine (they all make tradeoffs) I ended up using swig instead. |
Mustache supports this feature, however, Handlebars doesn't inherit it. It's so bad. |
I dont seem to be able to change the delimiter as defined in mustache:
{{=<% %>=}}
and then back to<%={{ }}=%>
Im trying to let a 3rd party WYSIWYG generate tags which is possible if I am able to customize the opening and closing tags. Is there another way to do this? Im using handlebars with node.js and express 3.0.
The text was updated successfully, but these errors were encountered: