- From: Marc Portier <mpo@outerthought.org>
- Date: Thu, 28 Apr 2011 09:17:25 +0200
- To: uri@w3.org
Hi all, Finally got round at this javascript implementation of http://tools.ietf.org/html/draft-gregorio-uritemplate-04 (minus the partial syntax and some more testing) Anyway, it is open at: https://github.com/marc-portier/uri-templates It wraps inside JQuery and comes with tests up in QUnit. (JQuery dependency currently limited to the handy $.extend and $.isFunction) Must say getting my head around things asked more time then I initially expected: clarity and elegance of the syntax and explanation did hide quite some more special cases then I would of have thought of. One case I still haven't ironed out, to the extend I'm liking my solution more :) is this: > tested pattern: {;list} > Expected: ";val1,val2,val3" > Result: ";list=val1,val2,val3" > > tested pattern: {;keys} > Expected: ";key1,val1,key2,val2" > Result: ";keys=key1,val1,key2,val2" > which in my mind (and implementation) follows more closely the line of thinking in: > > tested pattern: {?list} > Expected: "?list=val1,val2,val3" > > tested pattern: {?keys} > Expected: "?keys=key1,val1,key2,val2" > the consistency I see is this: both ; and ? operators deal with named parameters, in unexploded form the values are wrapped up in one string, but still expect value. best regards, -marc= PS: The link to the promised js implementation from http://code.google.com/p/uri-templates/wiki/Implementations points to some reserved space at www.snellspace.com (I remember grabbing a 0.3 implmentation from James' blog way back, that is somewhat maintained over here: )
Received on Thursday, 28 April 2011 19:30:22 UTC