Mustache.jl
Mustache.jl copied to clipboard
(Not indefinitely) Recursive partials templates fail to parse
I created a minimal test file pair in https://github.com/Kissaki/Mustache.jl/commit/d56e7fca783216de10eb1560c9ff27540ff6d8f8
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.
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.
Thx. I’ll have a look.
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.
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.
It passes your test, but if you have something more involved you can dev a branch of a package pretty easily. Something like dev pkg#branch.
On Sat, Nov 3, 2018 at 11:31 AM Jan Klass [email protected] wrote:
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.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/jverzani/Mustache.jl/issues/82#issuecomment-435596581, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZvTODG4pgYCQA69yCsNRymioV1z2-Yks5urbbDgaJpZM4YJlyz .
-- John Verzani Department of Mathematics College of Staten Island, CUNY [email protected]
I don’t have anything more involved.
Okay. I’ll merge. If there are issues it can be rethought. Thanks again.
On Sat, Nov 3, 2018 at 2:12 PM Jan Klass [email protected] wrote:
I don’t have anything more involved.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/jverzani/Mustache.jl/issues/82#issuecomment-435609252, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZvTCOBmLLBv4wnj9s5doaBxqAhwXh_ks5urdyigaJpZM4YJlyz .
-- John Verzani Department of Mathematics College of Staten Island, CUNY [email protected]
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:
https://github.com/Kissaki/Mustache.jl/commit/917a34e74963c228933687f5473e2bb97968491b
{{.}}
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
Thank you for the fixes. At least for my use case, it seems to work for multi-level-recursed partials.