Translate cross reference to a link

21 views
Skip to first unread message

Rowan Goemans

unread,
Feb 5, 2018, 9:24:32 AM2/5/18
to sphinx-dev
In an extension I want to make use of existing references and allow a user to cross reference. The plugin in question outputs svg so directly keeping the ref in the result won't work. So what I want to do is translate an rst fragment to the form it would represent in the output. For instance if I would pass `google <www.google.com>`_ It would the return the correct format for the output specified. The same should work for using roles or domain references. This is done so I can then substitute the rst in the svg and put in the actual link. I can't find how to do something like this. Even reading parts of the builder source code I can't see how I can do this. I hope somebody can push into the direction how I can manage something like this.

Regards, Rowan Goemans

Guenter Milde

unread,
Feb 5, 2018, 2:41:07 PM2/5/18
to sphin...@googlegroups.com
On 2018-02-05, 'Rowan Goemans' via sphinx-dev wrote:

> [-- Type: text/plain, Encoding: --]
Have a look at the Docutils documentation utilities (also used by Sphinx to
translate rST to the desired output formats).
You most probably want to use it programatically, so
`the Docutils publisher`__ might be the right place to look.

__ http://docutils.sourceforge.net/docs/api/publisher.html

sincerely,
Günter

Reply all
Reply to author
Forward
0 new messages