5

I do understand how to create a glossary in Sphinx RST, and how to link to its terms:

.. glossary::

   term1
      description of term1

Linking to :term:`term1` is easy.

My question is, how can I link to terms in the glossary of a different Sphinx project, for which I have an intersphinx definition?

For example, I have an intersphinx definition for the Sphinx documentation of Python 2:

intersphinx_mapping = {
  'py': ('https://docs.python.org/2/', None),
}

But I was not successful in specifying a link to one of its glossary terms, using any of these constructs in the RST source:

:ref:`py:iterable`
:ref:`py:glossary.iterable`
:term:`py:iterable`
:term:`py:glossary.iterable`

Is that possible, and if so how does the definition of the glossary need to look like and how the reference to a glossary term?

mzjn
  • 48,958
  • 13
  • 128
  • 248
Andreas Maier
  • 2,724
  • 1
  • 26
  • 30
  • What if you set `‘python’:`, that’s what I have done before (see e.g. https://github.com/textbook/aslack/blob/master/docs/conf.py#L45) and matches the docs http://www.sphinx-doc.org/en/stable/ext/intersphinx.html. – jonrsharpe Sep 28 '17 at 16:10
  • 1
    Are you sure that ``:term:`py:iterable` `` doesn't work? It does for me. And ``:term:`iterable` `` works too. – mzjn Sep 28 '17 at 16:30
  • @mzjn After throwing all build artefacts away and rebuilding, both ``:term:`py:iterable` `` and ``:term:`iterable` `` work. I'm not sure whether the fresh rebuild caused this, but before that, I was able to repeat the non-working situation multiple times. The errors were: "WARNING: undefined label: py:iterable (if the link has no caption the label must precede a section header)" and "WARNING: term not in glossary: py:glossary.iterable". Thanks for your comment! – Andreas Maier Sep 29 '17 at 08:21
  • @jonrsharpe That now works too, but I would suspect that it was not the key change that caused it to work (see my other comment). Thanks, anyway! – Andreas Maier Sep 29 '17 at 08:25

0 Answers0