summaryrefslogtreecommitdiff
path: root/sphinx/util/nodes.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2023-05-09 22:57:39 +0100
committerGitHub <noreply@github.com>2023-05-09 22:57:39 +0100
commit706f5f9cc83f1d62829bb18ad40bfa5e784e202c (patch)
tree1507067d704327404f565136631771b34a447a7e /sphinx/util/nodes.py
parentdb546189ce1d2a345f4399367ced6ecdd538be5d (diff)
downloadsphinx-git-706f5f9cc83f1d62829bb18ad40bfa5e784e202c.tar.gz
Warn on deprecated Python-specific index types (#11412)
Diffstat (limited to 'sphinx/util/nodes.py')
-rw-r--r--sphinx/util/nodes.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 1b43bd72e..3dfdd4f26 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -365,19 +365,23 @@ def process_index_entry(entry: str, targetid: str,
if entry.startswith('!'):
main = 'main'
entry = entry[1:].lstrip()
- for type in pairindextypes:
- if entry.startswith(type + ':'):
- value = entry[len(type) + 1:].strip()
- value = pairindextypes[type] + '; ' + value
+ for index_type in pairindextypes:
+ if entry.startswith(f'{index_type}:'):
+ value = entry[len(index_type) + 1:].strip()
+ value = f'{pairindextypes[index_type]}; {value}'
+ # xref RemovedInSphinx90Warning
+ logger.warning(__('%r is deprecated for index entries (from entry %r). '
+ "Use 'pair: %s' instead."),
+ index_type, entry, value, type='index')
indexentries.append(('pair', value, targetid, main, None))
break
else:
- for type in indextypes:
- if entry.startswith(type + ':'):
- value = entry[len(type) + 1:].strip()
- if type == 'double':
- type = 'pair'
- indexentries.append((type, value, targetid, main, None))
+ for index_type in indextypes:
+ if entry.startswith(f'{index_type}:'):
+ value = entry[len(index_type) + 1:].strip()
+ if index_type == 'double':
+ index_type = 'pair'
+ indexentries.append((index_type, value, targetid, main, None))
break
# shorthand notation for single entries
else: