doc/emacs: split index category from label

A more verbose category is needed for the index, but not the
description in the manual.
This commit is contained in:
David Bremner 2022-07-31 08:33:20 -03:00
parent fe3db23684
commit 174221b179

View file

@ -110,6 +110,13 @@ class EmacsLispSymbol(ObjectDescription):
'defface': 'face' 'defface': 'face'
} }
category_for_objtype = {
'defcustom': 'Emacs variable (customizable)',
'defconst': 'Emacs constant',
'defvar': 'Emacs variable',
'defface': 'Emacs face'
}
@property @property
def cell(self): def cell(self):
"""The cell in which to store symbol metadata.""" """The cell in which to store symbol metadata."""
@ -120,6 +127,11 @@ class EmacsLispSymbol(ObjectDescription):
"""The label for the documented object type.""" """The label for the documented object type."""
return self.objtype return self.objtype
@property
def category(self):
"""Index category"""
return self.category_for_objtype[self.objtype]
def handle_signature(self, signature, signode): def handle_signature(self, signature, signode):
"""Create nodes in ``signode`` for the ``signature``. """Create nodes in ``signode`` for the ``signature``.
@ -137,7 +149,7 @@ class EmacsLispSymbol(ObjectDescription):
def _add_index(self, name, target): def _add_index(self, name, target):
index_text = '{name}; {label}'.format( index_text = '{name}; {label}'.format(
name=name, label=self.label) name=name, label=self.category)
self.indexnode['entries'].append( self.indexnode['entries'].append(
('pair', index_text, target, '', None)) ('pair', index_text, target, '', None))