NancyFx/Nancy — pull request #881 by codeprogression (2012-12-26 17:37:26+00:00)
Title: Fix invalid characters in view path when using regex in module path

_As discussed last week in Jabbr_

If you define a regex in the module path, the view location chokes on the regex characters. Before the reordering of the view conventions, this issue was hidden because we were hard-coding the paths inside the views folder (and this convention was evaluated first) and we never reached the module path conventions. _Ideally, the module path used by the views would be generated at runtime and stored_; however, this doesn't seem feasible given the way the request path is evaluated for variables.

This PR adds an extension method, similar to `module.GetModuleName()`, called `GetModulePath(context)`.

The extension method works as follows:

1. If the module path is empty, return empty
2. If the module path does not have regex or paramaterized characters ("(?" or "{"), return the modulepath.
3. Otherwise:
* Split the module path and request path segments at "/"
* If the request path segment length is less than module path segments, return an empty string
* Otherwise, return the request path truncated to the number of segments in the module path

I updated `DefaultNancyModuleBuilder.CreateNegotiationContext(module, context)` to use the new extension method instead of returning the defined module path.