Harmonise references to Sphinx versions (#11361)

This commit is contained in:
Adam Turner 2023-04-27 01:02:09 +01:00 committed by GitHub
parent 8dd44d1e13
commit 616ba29f28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -1119,8 +1119,9 @@ class Sphinx:
.. versionadded:: 0.6 .. versionadded:: 0.6
.. versionchanged:: 2.1 .. versionchanged:: 2.1
Take a lexer class as an argument. An instance of lexers are Take a lexer class as an argument.
still supported until Sphinx-3.x. .. versionchanged:: 4.0
Removed support for lexer instances as an argument.
""" """
logger.debug('[app] adding lexer: %r', (alias, lexer)) logger.debug('[app] adding lexer: %r', (alias, lexer))
lexer_classes[alias] = lexer lexer_classes[alias] = lexer

View File

@ -1368,7 +1368,7 @@ class PythonDomain(Domain):
type, searchmode) type, searchmode)
if not matches and type == 'attr': if not matches and type == 'attr':
# fallback to meth (for property; Sphinx-2.4.x) # fallback to meth (for property; Sphinx 2.4.x)
# this ensures that `:attr:` role continues to refer to the old property entry # this ensures that `:attr:` role continues to refer to the old property entry
# that defined by ``method`` directive in old reST files. # that defined by ``method`` directive in old reST files.
matches = self.find_obj(env, modname, clsname, target, 'meth', searchmode) matches = self.find_obj(env, modname, clsname, target, 'meth', searchmode)

View File

@ -360,10 +360,10 @@ def _resolve_reference_in_domain(env: BuildEnvironment,
) -> nodes.reference | None: ) -> nodes.reference | None:
# we adjust the object types for backwards compatibility # we adjust the object types for backwards compatibility
if domain.name == 'std' and 'cmdoption' in objtypes: if domain.name == 'std' and 'cmdoption' in objtypes:
# until Sphinx-1.6, cmdoptions are stored as std:option # cmdoptions were stored as std:option until Sphinx 1.6
objtypes.append('option') objtypes.append('option')
if domain.name == 'py' and 'attribute' in objtypes: if domain.name == 'py' and 'attribute' in objtypes:
# Since Sphinx-2.1, properties are stored as py:method # properties are stored as py:method since Sphinx 2.1
objtypes.append('method') objtypes.append('method')
# the inventory contains domain:type as objtype # the inventory contains domain:type as objtype