Refactor the link-tracking code and move it from framework.

This code has a dependency on SiteTree, so it fits much better in the
cms module.

Abstracted away the content parser so the same code can be reused both
in the render phase (to highlight the links) and in the write phase
(storing information about broken links and references).