-
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
Issue with named blocks when a partial is used inside of for loops #83
Comments
Reproducable on http://ectjs.com: |
The issue seems to stem the tracking of named blocks being somewhat naïve. Lines 303 to 306 in 0edfa8c
In my example, a block with the same name already exists (because I'm using the partial inside of a loop) and therefore the existing block is used. |
This is problem of coffee-script itself, not ECT. for i in [0..10]
do (i) ->
print i |
And yes, blocks are not a good idea here. |
I don't think that's correct. As you can see in the example above, the context is fine for unnamed blocks. ...
<span id="person_0">Hello Alice!</span>
...
<span id="person_1">Hello Bob!</span>
... The issue appears to be that blocks can't be redefined as in #80. If you can provide an example of how using |
What do you mean by that? |
Blocks are not good because #80 <% fn (attr) => %>
write something: <%= attr %>
<% end %>
...
<%- fn (attributes...) %> |
Thanks for the tip. Seems to be the best option as a workaround for now. |
Below is a contrived example that demonstrates my issue.
base
person
people
This produces:
The text was updated successfully, but these errors were encountered: