goods/tmpl — Issue #4: Selectors
Author: zeebo
Created: 2012-03-04 18:08:50+00:00
State: open
Labels: question

Currently the idea for selectors is to have push and pop operations on identifiers, so for example, some parsings

.foo.bar$ -> push foo push bar pop
$$foo -> pop pop foo

Now I can normalize these operations such that it starts with a number of pops, then a chain of push ident. So

.foo.bar$ -> push foo
$$foo -> pop pop foo

That's all fine. the question is about sub contexts in blocks, with, and range statements and how they interact with pop. Assuming the context is a dict like

{
'foo': 'foo',
'bar': {
'foo': 'baz',
'bam': {
'zap': 'zap'
}
}
}

what is the output of something like

{% with .bar.bam %}{% .zap %}{% end with %} -> 'zap'
{% with .bar.bam %}{% $foo %}{% end with %} -> 'baz' or 'foo' ?

same for ranges and blocks.