Switch to detecting the version in the docs

We use git to detect the latest tag and report the tag version if we're
sitting on that tag and otherwise report 'latest' and warn that the
current docs don't necessarily reflect a released state of the code.

We try to provide appropriate warnings depending on whether we're on
readthedocs server or not.
Merge branch 'readthedocs'