Dear Sphinx-gurus!

Part of this post was posted originally as an issue on github, but 
meanwhile I believe that I only need some help in using sphinx 
appropriately.

I am trying to compile a texinfo reference manual for sagemath, which uses 
sphinx. There, I have many references of the form
```
    :class:`~sage.structure.factory.UniqueFactory` 
```

which are translated into a node of the form
```
    <reference internal="False" reftitle="(in Sage Reference Manual: Basic 
Structures v7.4)" 
refuri="../../../../../../html/en/reference/structure/sage/structure/factory.html#sage.structure.factory.UniqueFactory"><literal
 
classes="xref py py-class">UniqueFactory</literal></reference> 
```

I'd like to turn them into references to the appropriate info manual.  I 
have meanwhile worked part of my way through the sphinx source, and suspect 
that I need to use the `missing_reference` "event". The relevant snippet 
from `environment.py` seems to be
```
# no new node found? try the missing-reference event
if newnode is None:
    newnode = builder.app.emit_firstresult('missing-reference', self, node, 
contnode)
```
Unfortunately, I have no clue yet how I can use this.

I can see (by inserting a print statement :-) that 
`intersphinx.missing_reference` is called when building the texinfo 
documentation. How can I tweak this? Essentially, I want to replace the 
path to the html document and the html anchor by the path to the info file 
and the info anchor. So, it seems to me that I need to replace the 
following few lines from `intersphinx.missing_reference`, right?
```
if '://' not in uri and node.get('refdoc'):
    # get correct path in case of subdirectories
    uri = path.join(relative_path(node['refdoc'], env.srcdir), uri)
newnode = nodes.reference('', '', internal=False, refuri=uri,
                                              reftitle=_('(in %s v%s)') % 
(proj, version))
```
If I'm not mistaken, the question is only how I can make sphinx call my 
personal "missing_reference" function. Or should I be doing something else.

Help is very very much appreciated.  Many thanks in advance,

Martin

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to