Skip to content

Commit

Permalink
fix sphinx-doc#10456: fix sphinx.domain.python.filter_meta_fields()
Browse files Browse the repository at this point in the history
The function now removes all "meta"-fields from a field-list.
  • Loading branch information
Anselm Kruis committed May 16, 2022
1 parent 6ffe881 commit d1ba8d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sphinx/domains/python.py
Expand Up @@ -1068,11 +1068,11 @@ def filter_meta_fields(app: Sphinx, domain: str, objtype: str, content: Element)
for node in content:
if isinstance(node, nodes.field_list):
fields = cast(List[nodes.field], node)
for field in fields:
# removing list items while iterating the list needs reversed()
for field in reversed(fields):
field_name = cast(nodes.field_body, field[0]).astext().strip()
if field_name == 'meta' or field_name.startswith('meta '):
node.remove(field)
break


class PythonModuleIndex(Index):
Expand Down

0 comments on commit d1ba8d5

Please sign in to comment.