Re: URI Templates - optional variables?

On 10/15/07, John Cowan <cowan@ccil.org> wrote:
>
> Mike Schinkel scripsit:
>
> > I'll throw my earlier suggestions to use a name and colon where the default
> > is just {var}:
> >
> >       {<arg|var}  ->   {prefix:var,stuff}
> >       {>arg|var}  ->   {append:var,stuff}
> >       {,arg|var}  ->    {join:var,stuff}
> >       {&arg|var}  ->   {joinlist:var,stuff}
>
> The reason that Joe's proposal uses | (an earlier draft used :) to separate
> stuff and var(s) is that | is illegal in URIs.  You need some way to escape
> it in the template, such as \|, but this only comes up when you want an
> explicit "%7E" sequence in the URI.
>
> (Which reminds me:  Joe doesn't actually say that non-URI characters
> appearing in the stuff should generate %-escapes in the result, but
> that's the intention.)

Actually my intention was that everything from after the <op> operator to
the | would be put into the result w/o needing further escaping. Using | as
the separator means that no special escaping is needed for |, ala \|, since
that can never legally appear in a URI. It makes the parsing much easier.

   -joe

-- 
Joe Gregorio        http://bitworking.org

Received on Monday, 15 October 2007 18:11:43 UTC