def add_references(app, doctree):
source = doctree.document.attributes['source']
- for node in doctree.traverse():
+ 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.