Skip to content

Commit

Permalink
Document sphinx.domains.IndexEntry (#12820)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
SilverRainZ and AA-Turner committed Sep 2, 2024
1 parent 15aadd6 commit d347149
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
4 changes: 4 additions & 0 deletions doc/extdev/domainapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Domain API
.. autoclass:: Index
:members:

.. autoclass:: IndexEntry
:members:
:member-order: bysource

.. module:: sphinx.directives

.. autoclass:: ObjectDescription
Expand Down
65 changes: 31 additions & 34 deletions sphinx/domains/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,41 @@


class IndexEntry(NamedTuple):
"""
An index entry.
.. note::
The *qualifier* and *description* are not rendered for some output formats,
such as LaTeX.
"""

#: The name of the index entry to be displayed.
name: str

#: The sub-entry related type. One of:
#:
#: ``0``
#: A normal entry.
#: ``1``
#: An entry with sub-entries.
#: ``2``
#: A sub-entry.
subtype: int

#: *docname* where the entry is located.
docname: str

#: Anchor for the entry within `docname`
anchor: str

#: Extra info for the entry.
extra: str

#: Qualifier for the description.
qualifier: str

#: Description for the entry.
descr: str


Expand Down Expand Up @@ -75,39 +104,7 @@ def generate(
``content``:
A sequence of ``(letter, entries)`` tuples, where ``letter`` is the
"heading" for the given ``entries``, usually the starting letter, and
``entries`` is a sequence of single entries. Each entry is a sequence
``[name, subtype, docname, anchor, extra, qualifier, descr]``. The
items in this sequence have the following meaning:
``name``
The name of the index entry to be displayed.
``subtype``
The sub-entry related type. One of:
``0``
A normal entry.
``1``
An entry with sub-entries.
``2``
A sub-entry.
``docname``
*docname* where the entry is located.
``anchor``
Anchor for the entry within ``docname``
``extra``
Extra info for the entry.
``qualifier``
Qualifier for the description.
``descr``
Description for the entry.
Qualifier and description are not rendered for some output formats such
as LaTeX.
``entries`` is a sequence of single entries.
Each entry is an :py:class:`IndexEntry`.
"""
raise NotImplementedError

0 comments on commit d347149

Please sign in to comment.