On Wed, Sep 30, 2009 at 1:33 PM, Steven Roussey <[email protected]> wrote:
>
>> {num|plural? data datum}
>>
>> --> "datum" if num = 1
>> --> "data" if num > 1
>>
>> But what if you want spaces in your arguments? It lets you do this:
>>
>> {num|plural?.there are many.there is one}
>>
>> The first character after "plural?" is the argument separator now.
>> This is like sed/perl: you can do s/foo/bar, or you can do
>> s.this/has/slashes/.replacement.string.too.
>>
>> This isn't a huge deal, but I would want to have this flexibility,
>> especially since it doesn't cost anything.
>
> Yes, the _CALL_RE should have \b to break from the name and the
> arguments. I currently trim, but it is not a big deal to not do it.
>
>> How about I generate some cross-language tests and do it in Python,
>> and do you want to follow up with JavaScript and/or PHP?
>
> Sounds good.
>
>> And what do you think about {.moderator?} vs {.if moderator} ?
>
> I like that things that start with a . are part of the language only.
>
>> The chaining is important. Either of these looks wrong:
>>
>> {.if singular}
>> there is one
>> {.else}
>> {.if plural}
>> there are many
>> {.else}
>> there are None
>> {.end}
>> {.end}
>>
>> (Too ugly, bad indentation)
>>
>> {.if singular}
>> there is one
>> {.if plural} <-- this would be normally be elif
>> there is one
>> {.else}
>> there are none
>> {.end}
>>
>> (Not what you expect of if/else/end)
>>
>> Instead this looks cleanest to me:
>>
>> {.singular?}
>> there is one
>> {.plural?}
>> there are many
>> {.or}
>> there are None
>> {.end}
>
>
> I was working on doing this:
>
> {.if singular}
> there is one
> {.or plural}
> there are many
> {.or}
> there are None
> {.end}
Hm, actually the extra 'or' might be good there:
{.singular?}
one
{.or plural?}
many
{.or}
none
{.end}
The way I have it, you can't nest predicates:
{.test1?}
{.test2?} <-- this starts a new clause, not a new section
{.end}
{.end} <-- error because the last 'end' ends the whole chain
I'll have to think about it a bit.
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
-~----------~----~----~----~------~----~------~--~---