The internal references were not properly created. This patches make the
:ref: inline markup create a <xref> tag when the reference is internal.
This patch also reworks the sphinx extension to handle the URLs that
will be generated in the hot-reference with the new :ref: behavior.
Closes-Bug: #1378073
Change-Id: I84bf268dc1055dc6b39f23c4415734184ec57eec