Subject: | Update for the V4 Spec? |
Date: | Tue, 15 Mar 2011 20:26:46 -0700 |
To: | bug-uri-template [...] rt.cpan.org |
From: | "David E. Wheeler" <dwheeler [...] cpan.org> |
Version 4 of the URI Template spec was published in March, 2010. I don't know what the status of the RFP is, but v4 seems pretty useful.
http://tools.ietf.org/html/draft-gregorio-uritemplate-04
There are new operators, less verbose than the old `{-var}` operators. And some are really useful. I'm particularly interested in the `{+var}` operator:
Show quoted text
> 3.6. Reserved expansion: {+var}
>
>
> Reserved expansion is identical to simple expansion except that the
> substituted values may contain characters in the reserved set.
>
> For example,
>
> foo := "That's right!"
>
> "{foo}" -> "That%27s%20right%21"
> "{+foo}" -> "That%27s%20right!"
>
> base := "http://example.com/home/"
>
> "{base}index" -> "http%3A%2F%2Fexample.com%2Fhome%2Findex"
> "{+base}index" -> "http://example.com/home/index"
>
> The same expansion process is followed as in
> Section 3.5
> except that,
> instead of replacing any character within each value string that is
> not in the unreserved set with its corresponding sequence of pct-
> encoded octets, replace any character within each value string that
> is not in the set of unreserved or reserved characters with its
> corresponding sequence of pct-encoded octets.
I could really use this for constructing URIs to PGXN documentation where the path to the docs might have a slash in it.
Anyway, was chatting with RJBS about this stuff, and he asked for a ticket so he'd remember to look into it. So here it is. Will help me to nag now and then, too (I'm currently using a nasty hack to emulate `{+var}`.
Best,
David