-
Notifications
You must be signed in to change notification settings - Fork 69
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
Redefined blocks now actually work as expected #80
base: master
Are you sure you want to change the base?
Conversation
This appears to fix #83 but without a test suite it's impossible to know the impact of these changes. |
@@ -302,7 +302,7 @@ | |||
|
|||
TemplateContext.prototype.block = function (name) { | |||
if (!this.blocks[name]) { this.blocks[name] = ''; } | |||
return !this.blocks[name].length; | |||
return true || !this.blocks[name].length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter part of this conditional statement becomes unreachable with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That to say, since this always returns true then it should likely not return anything and any code relying on it be refactored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that so that the previous statement would still exist there and goad someone who knows why it's there to change it. It could merely be commented out though.
@baryshev could you take a look at this please? |
Been using this in production for a few weeks now and I'm not seeing any problems, but, a test suite would be pretty nice. |
Fixes #79. I'm not 100% sure that this doesn't break anything but from my tests it seems to be fine. Would be great if someone who knows ECT could make this more elegant.
Basically makes this work as you would expect:
base.ect
imageBox.ect
The above example previously would compile both
<< include 'imageBox' >>
to only the first block content ( `111.png ).I'd imagine something like this could be used to make #50 work as well without too much pain.