> But there's a problem as you've defined it: sections can't contain
> .name lookups now. Even if they could, the lookup is "direct", not
> the type that walks the stack. The fundamental problem is that for a
> section, you're looking for context to test for truth and push on the
> stack, while in a substitution, you're looking for a value to put in
> the output. These just can't be made the same.
Sure they could. It's a bit surprising
that they're different now anyway.
In both cases you are looking for a value.
The fundamental problem I have with predicates
as a special case is the reuse of the | syntax.
If predicates were written {.section num?plural}
then it would be clear they were a different case.
> In the end I think that the practical matter of formatting sections is
> vital. This was asked for by users, and it will fix nastiness I have
> in my doc/makedocs.py stuff. There will be a bunch of silly Python
> code eliminated in favor of simple, declarative templates.
I think this would be great, but I wonder
if there is better syntax. On the page,
{.section a|b} looks like a section with
argument a|b, but in fact it is {(.section a)|b}.
I think it would make more sense to add a
separate "pipe this block through a filter"
operator than overload .section. .section is
about testing conditions and walking into structs.
Your example:
{.section program|html}
if (n < 3 && m > 4) ...
{.end}
does not have any substitutions, and that
sounds like a common case. So why
should the reformatting of a block require
pushing a new variable on the evaluation stack?
Russ
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---