mojombo/jekyll — pull request #944 by x3ro (2013-04-09 22:11:20+00:00)
Title: WIP - Improve permalink generation for URLs with special characters

This PR is a WIP attempt to solve #782 :smile: Since I'm not sure what the best possible way to proceed is, I'm posting it to get some feedback.

I've already refactored everything I found that is related to URL generation into the `URL` module, which is now included in `Post` and `Page`. Those two only specify what placeholders they'd like to have replaced by means of `url_placeholders` and the `URL#url` method does the rest. Note that in the current `url_placeholders` method there is still some URL escaping going on, which I'll still refactor).

In the current state, all tests still pass, and the next step would be to actually alter/improve the current URL generation, which, as described in #782, has a few shortcomings regarding special characters.

The general question is, how should the generated URLs look, and is it acceptable to make breaking changes in permalink generation. I've already played around a bit, and found [Stringex](https://github.com/rsl/stringex), which seems to generate fairly useful output, but using it would break the current URL generation tests, since some of the output is simply different (for example, it converts everything to lowercase, always). A more obvious downside is the fact that it tries to do stuff like this though:

"10% off if you act now".to_url => "10-percent-off-if-you-act-now"

While awesome, this creates the need to specify a locale for permalink generation, which might one _could_ consider overkill.

I'd really like to hear your opinions on this one.