> I'm not sure what you're getting at here. Can you post a real
> example? "foo" and "advancedSetting" are BOTH keys in your JSON
> dictionary.
Yes, exactly.
> The predicate is a function which receives a JSON node. The JSON node
> is named in the section.
Yes, but...
data={ moderator:true, post: {id:52, title:"Hi",
message:"there"},... }
{.section post moderator|true?}
<button id="{id}">Delete</button>
{.end}
The way I implemented it, if the text "moderator|" was omitted, the
meaning would simply be a test on post|true? Having both json nodes
means that I can step into the post node while testing on the
moderator node.
Also, I implemented parameters (to formatters and predicates).
{.section post role|isValue("moderator")?}
<button id="{id}">Delete</button>
{.or post role|isValue("writer")?}
<button id="{id}">Reply</button>
{.end}
{.section post|cleanlanguage("G") }
{.message}
{.end}
or
{.section post }
{.message|cleanlanguage("G")}
{.end}
The parameters are appended. I'm not sure why you omitted parameters.
(I only allow parameters that can be encoded as json). I can see now
why you omitted expressions, and changed my version to strip that out
and use predicate functions. But I don't see why there are no
parameters. Yet.
> These are the definitions of the predicates:
>
> def Plural(num):
> return num > 1
>
> def Singular(num):
> return num == 1
I'll add singular and plural to my standard predicates. Good idea. :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---