Commits

Udo Spallek committed 5db2682

Move node check to node.traverse condition argument.

  • Participants
  • Parent commits 2b9e0ab

Comments (0)

Files changed (1)

File sphinxcontrib/inheritance.py

 
 def add_references(app, doctree):
     source = doctree.document.attributes['source']
-    for node in doctree.traverse():
-        if isinstance(node, (
-                docutils.nodes.Inline,
-                docutils.nodes.Text,
-                )):
+    for node in doctree.traverse(condition=lambda n:not isinstance(
             # We do not want to consider inline nodes such as emphasis,
             # strong or literal. Nor Text nodes which are the part of the
             # paragraph that precede an inline node. There's already the
             # Paragraph node and the anchor is added to it.
-            continue
+            n, (
+                docutils.nodes.Inline,
+                docutils.nodes.Text))):
         if not node.parent:
             continue