Merge pull request #6177 from tk0miya/6172_AttributeError_for_old_styled_index

Fix #6172: AttributeError is raised for old styled index nodes
This commit is contained in:
Takeshi KOMIYA 2019-03-17 18:41:55 +09:00 committed by GitHub
commit 33ba281e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -32,6 +32,7 @@ Bugs fixed
classes attribute refers missing citation (refs: #6147)
* #2155: Support ``code`` directive
* C++, fix parsing of braced initializers.
* #6172: AttributeError is raised for old styled index nodes
Testing
--------

View File

@ -58,12 +58,12 @@ class IndexEntriesMigrator(SphinxTransform):
def apply(self, **kwargs):
# type: (Any) -> None
for node in self.document.traverse(addnodes.index):
for entries in node['entries']:
for i, entries in enumerate(node['entries']):
if len(entries) == 4:
source, line = get_source_line(node)
warnings.warn('An old styled index node found: %r at (%s:%s)' %
(node, source, line), RemovedInSphinx40Warning)
entries.extend([None])
node['entries'][i] = entries + (None,)
def setup(app):