hoodwink.d enhanced
 

juretta.com

URI-Template gem released | March 15, 2008-->

March 15, 2008

URITemplate is a parser for URI Templates as defined in the URI Template specification (http://bitworking.org/projects/URI-Templates).

URI Templates are strings that contain embedded variables that are transformed into URIs after embedded variables are substituted. This specification defines the structure and syntax of URI Templates.

A simple example shows the usage: http://example.com/search?q={searchTerms}&num={count} can be expanded to

http://example.com/search?q=hello%20world&num=5
http://example.com/search?q=ruby&num=100

by supplying different variables for searchTerms and count.

http://bitworking.org/projects/URI-Templates/ is the homepage of the current draft. http://code.google.com/p/uri-templates/ hosts the current reference implementation in Python.

Install the Ruby gem:

macbook-pro:~ stefan$ sudo gem install uri-templates
Treetop - go look at it

After playing around with Ragel and ANTLR I decided to use the excellent Treetop (Parsing expression grammar implementation) to implement the URI template specification. Although the draft explicitly states that you do not need a full full-fledged parser, Treetop made it really easy to implement just that.

Get the source:

macbook-pro:~ stefan$ git clone git://scm.juretta.com/uri-templates.git

Diggman

Add a New Comment

About

juretta.com is the personal workspace of Stefan Saasen. You can send him an email or read more about this site in the „About“ section.

« Previous entry

New Zealand Daylight Saving Time Chan...
posted about 1 year ago

Recent comment

On: “Attachr.com: OpenID support added

You need to kill this spam stuff!

posted about 1 year ago by entropie

Look!

Latest links  RSS  

More...