Discussion:
Get output of a cross reference in the style of the appropiate builder
(too old to reply)
'Rowan Goemans' via sphinx-dev
2018-07-24 02:25:44 UTC
Permalink
Hello everyone,

I am extending a sphinx extension and I want to be able to include cross
references. The plugin itself translates some text to other text which I
can do fine in the visitor functions.

What I want to do is that I want to be able to use a cross reference in my
input text. So something like

.. MyDirective::
Hello everyone, This text will be processed in my plugin. But This
cross reference should still work.
:ref:`my-reference-label`


Will be processed. I can detect the :ref:`my-reference-label` in my extension but I cannot find anywhere in how I can turn this into an appropiate link to insert into the body, so for html that would become a link tag to the appropiate location and for latex it would become a hyperref.
Maybe I am missing something really simple but I can't find it all.

In the sample extension: http://www.sphinx-doc.org/en/master/extdev/tutorial.html#the-event-handlers. A url is manually constructured but obviously I don't know at all where the ref is in my case. Also that would only work for HTML output and not for latex or others.

Any help is appreciated.
--
You received this message because you are subscribed to the Google Groups "sphinx-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-dev+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...