mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++, add support for removing index text prefixes
Closes sphinx-doc/sphinx#1958.
This commit is contained in:
parent
9ec75826af
commit
678630a59b
2
CHANGES
2
CHANGES
@ -90,6 +90,8 @@ Features added
|
||||
* #2682: C++, basic support for attributes (C++11 style and GNU style).
|
||||
The new configuration variables 'cpp_id_attributes' and 'cpp_paren_attributes'
|
||||
can be used to introduce custom attributes.
|
||||
* #1958: C++, add configuration variable 'cpp_index_common_prefix' for removing
|
||||
prefixes from the index text of C++ objects.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@ -2006,6 +2006,13 @@ Options for the XML builder
|
||||
Options for the C++ domain
|
||||
--------------------------
|
||||
|
||||
.. confval:: cpp_index_common_prefix
|
||||
|
||||
A list of prefixes that will be ignored when sorting C++ objects in the global index.
|
||||
For example ``['awesome_lib::']``.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
.. confval:: cpp_id_attributes
|
||||
|
||||
A list of strings that the parser additionally should accept as attributes.
|
||||
|
@ -3919,7 +3919,12 @@ class CPPObject(ObjectDescription):
|
||||
'report as bug (id=%s).' % (text_type(ast), newestId))
|
||||
|
||||
name = text_type(ast.symbol.get_full_nested_name()).lstrip(':')
|
||||
indexText = self.get_index_text(name)
|
||||
strippedName = name
|
||||
for prefix in self.env.config.cpp_index_common_prefix:
|
||||
if name.startswith(prefix):
|
||||
strippedName = strippedName[len(prefix):]
|
||||
break
|
||||
indexText = self.get_index_text(strippedName)
|
||||
self.indexnode['entries'].append(('single', indexText, newestId, '', None))
|
||||
|
||||
if newestId not in self.state.document.ids:
|
||||
@ -4364,5 +4369,6 @@ class CPPDomain(Domain):
|
||||
|
||||
def setup(app):
|
||||
app.add_domain(CPPDomain)
|
||||
app.add_config_value("cpp_index_common_prefix", [], 'env')
|
||||
app.add_config_value("cpp_id_attributes", [], 'env')
|
||||
app.add_config_value("cpp_paren_attributes", [], 'env')
|
||||
|
Loading…
Reference in New Issue
Block a user