Skip to content
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

(Not indefinitely) Recursive partials templates fail to parse #82

Open
Kissaki opened this issue Nov 1, 2018 · 9 comments
Open

(Not indefinitely) Recursive partials templates fail to parse #82

Kissaki opened this issue Nov 1, 2018 · 9 comments

Comments

@Kissaki
Copy link
Contributor

Kissaki commented Nov 1, 2018

I created a minimal test file pair in Kissaki@d56e7fc

The parsing takes a while, but then returns nothing.

Instead, I would expect the partial to include itself until the child element does not exist anymore, at which point it continues returning from the recursion.

@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 1, 2018

I ran into another issue that sheds some light. It looks like sections ({{#child}}) do not actually get the section context but instead retain the partial root context.

This seems to not be an issue on the first partial, but on the partial included by the partial. Hence, the context will not change to the child anymore, hence an endless recursion.

@jverzani
Copy link
Owner

jverzani commented Nov 2, 2018

Thx. I’ll have a look.

@jverzani
Copy link
Owner

jverzani commented Nov 3, 2018

Thanks again! I think this will address the issue appropriately. I limit the context that a partial is evaluated within, before it was the immediate context and its parent, so in your example y would always resolve within the parent, now it won't. This doesn't break the spec tests, so hopefully won't break anything you are otherwise doing, but do let me know if it does.

@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 3, 2018

Do you want me to test that PR or something?

I don't know how I would use and test a library locally that I otherwise get via package manager.

@jverzani
Copy link
Owner

jverzani commented Nov 3, 2018 via email

@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 3, 2018

I don’t have anything more involved.

@jverzani
Copy link
Owner

jverzani commented Nov 3, 2018 via email

jverzani added a commit that referenced this issue Nov 3, 2018
* address issue #82, comment on issue #83
@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 4, 2018

Should I create a new ticket?

I have a problem using recursive partials still. In my program it fails to pass on the context. I have difficulties reproducing it in a minimal setup. But what I could reproduce:

Kissaki@917a34e

{{.}} does not print anything in the second-level partial, but outside of it it dies.

The produced output:

Info: a
│     Outside: Dict("x"=>"b")
│     Inside:
│     b
│     Outside: Dict("x"=>"c")
│     Inside:
└     c

jverzani added a commit that referenced this issue Nov 5, 2018
This was referenced Nov 5, 2018
@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 10, 2018

Thank you for the fixes. At least for my use case, it seems to work for multi-level-recursed partials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants