On Tue, Oct 6, 2009 at 2:46 PM, Steven Roussey <[email protected]> wrote:
>
>> 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.
>
> So what is the name of the predicate?
>  - plural
>  - counter plural

It's completely up to the application.  JSON Template says nothing
about how it is interpreted.  I just implemented what I've been
talking about, which should hopefully clear it up:

http://code.google.com/p/json-template/source/detail?r=48e71023b458e0ecfeb019bff6bd43c5eca7edb5

See the 3 tests for concrete examples.  Now it will be much easier to
add more advanced formatters/predicates with args.  More examples
still TODO.

This means if you really want to be dirty, you can even eval() the
predicate string or formatter string.  So you could put arbitrary
Python/JS/PHP in the templates.  I really dislike that style of
templating, but if people are porting templates they may want this
flexibility.  I don't want to force any choices.

Also, I think the "Test"/"true" predicate can be built in -- a default
predicate.  I don't know what a good syntax/name for it is, but it's
just:

{.if test moderator}  # Look up the stack for "moderator"

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to