Level 4 URI template support

Cleanups based on full set of tests from the URI template repo.
Haven't included the negative tests, as I'm not totally sure how
to represent the failures in the library yet. Should be fairly
trivial to add in the future once the appropriate signalling is
worked out.