[refactor] Better URL modificiations.

The new solution leverages the URI parser that Google Caja is using to sanitize
HTML. This produces a much more stable URL structure and kill all pointless `null`
references in the URL's.