goods/tmpl — Issue #8: Pushing on previous contexts
Author: zeebo
Created: 2012-03-05 13:34:06+00:00
State: open
Labels: question

Assume we have this template

{% block foo $$.foo %}{% $.bar %}{% end block %}

how does this exactly work? say we're at the level /1/2/foo/3/4, so that the $$.foo would be selecting /1/2/foo, what does $.bar select? is it /1/2/foo/3/4/bar or /1/2/bar?

The first case is motivated by the idea that block always pushes a value on to the current stack. We selected the value /1/2/foo and so that gets appended to the current stack making the context /1/2/foo/3/4/foo, at which point we pop and select bar, so /1/2/foo/3/4/bar.

The second case is motivated by the idea of selecting our context for the block, so instead of the idea of pushing on to the stack, we're selecting where in the stack we will be inside of the block context.

I feel like if we do the second case, we should add support for the most top level element, maybe with some special selector identifier like uhhhhhh & or something we haven't used, but thats getting complicated. Thoughts?