Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using noindex with glossary in Sphinx

When using Sphinx 1.1.3, how can I create a .. glossary:: entry that does not show up in the automatically generated index?

I tried :noindex: in four places:

Before and after the glossary makes the glossary disappear.

.. :noindex: glossary:: 

    `term`
        definition

.. glossary:: :noindex:

    `term`
        definition

while putting it with the term makes the term clickable and displays the :noindex:.

.. glossary:: 

    :noindex: `term`
        definition

.. glossary:: 

    `term` :noindex:
        definition

My term has special characters, so I'm deliberately enclosing it with backticks.

like image 430
ramcdougal Avatar asked Jan 14 '13 16:01

ramcdougal


1 Answers

As I understand it, the glossary directive creates hooks for each of the terms that can be easily referenced from anywhere in the documentation; and that is going to end up in an index somewhere, at least internally at build time.

To work around this, you could use a standard list of definitions:

 term_1
   definition for term_1

 term_2
   definition for term_2

These definitions will then only be written locally and not appear in the main index. See reST docs for more detail on the syntax.

If you want to explicitly include some terms in such a list, you could use the :index: role.

 :index:`term_3`
   definition for an indexed term

and these terms will now appear in the index. However, unless it is very few terms, this is a clunky way of achieving what the glossary does for you; and loses out on the ability to use the cross-referencing (using syntax :term:`term_1`).

like image 65
Bonlenfum Avatar answered Oct 04 '22 16:10

Bonlenfum