Basic ref role for sphinx compatibility

A basic implementation of sphinx's ref role: http://sphinx-doc.org/markup/inline.html#role-ref

It doesn't work across documents, and it may fail or crash if you drift apart from the spec even a little, please report bugs if that happens ;-)