-
Notifications
You must be signed in to change notification settings - Fork 132
Subexpressions don't work with context resolving #80
Conversation
Its not like that, I think. result of I change your tests, If you think this is wrong, please explain it with more example. Thank you! |
@fzerorubigd you are wrong with your changes. In all my cases Here is the example:
Moreover, according to your changes |
We need a better argument parser and a simple way to detect variables from the "string" inside helpers. |
Before going for parsing arguments and stuff like that, I think we can use
|
@fzerorubigd, I agree. I think the current problem is tightly related with #74. It seems that all arguments stuff must be done in Handlebars core, not in a helper. As for subexpressions, they are useless without proper work with context resolving. |
@everplays, we cannot return string wrapper from a helper. Here any wrapper will be converted to string, so the parent helper will know nothing about such wrappers. |
That needs to be fixed as well. However, Regardless of #74, we need a way
|
I don't know exactly, How handlebars.js handle this? for example in |
Here is Handlebars.js specs for subexpressions: https://github.com/wycats/handlebars.js/blob/master/spec/subexpressions.js As I can see arguments in subexpressions are the same as in normal helpers:
|
https://github.com/wycats/handlebars.js/blob/f4b8c5260c203d6ab7631fa394696f5c7a442586/spec/subexpressions.js#L125 is what we need which, from my understanding, is what I have described. @fzerorubigd, @JustBlackBird What do you think? |
@everplays, as I can see helpers always return strings, not variables names. @fzerorubigd I found one more problem with tests. Here the test helper does not resolve variable name, but it should to! The correct helper's body is: return $context->get($arg) . 'Test.'; As the result the tests are false positive, because they describe incorrect behavior. @everplays, @fzerorubigd May be I should create a separate issue for discussion? |
@JustBlackBird yes. Please create a seperate issue for that one too. |
In the current implementation subexpressions do not work with context at all.
I've created several tests to illustrate the problem.