On Mon, Oct 5, 2009 at 10:06 PM, Andy Chu <[email protected]> wrote: > On Mon, Oct 5, 2009 at 1:56 PM, Steven Roussey <[email protected]> wrote: >> >>> Can you show an example of this? Not sure what you mean. You want an >>> explicit data argument for predicates? >> >> (Optionally) yes. So... >> >> {.if counter plural} >> >> If you are looking at something hundreds of lines long and just see: >> >> {.if plural} >> >> You start wondering what the heck is or is not plural... > > Right, but just like formatters, you can interpret the predicate > string however you want -- in this case it's "counter plural". So you > can interpreter one part as a string identifying a node. If you have > the context, you can look up the argument. I'll try to code this up. > > On another note, I think I'm going to accept ".if", but something that > ends with ? is also an implicit if. That is: > > {.if singular?} > > and > > {.singular?} > > are the same thing.
OK I added the predicates that take contexts. So doing this type of thing is technically feasible. There is still the API change to make it into a FunctionRegistry object rather than straight dicts/functions. The example is that the Debug? predicate tests if there is a "debug" attribute set to true. This will look outside of the current node. http://code.google.com/p/json-template/source/detail?r=7b93fefbbd0efdd70e0eae3a5773bb5e66afaff9 Andy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
