handle reno 2.9.0 anchor references

Reno produces anchor references for sections automatically now, and
those don't have URIs set up so we want to ignore them. If we do have
another target that does have a URI we want to include that, so test
whether we have the URI before including the target info in the
output.

Change-Id: I84f1b67b3078662f72c09c0f69bd09a45a7fe83e
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-04-25 15:03:15 -04:00
parent 69c1b0db4d
commit 4a1c52a1ee
1 changed files with 7 additions and 1 deletions

View File

@ -813,7 +813,13 @@ class TextTranslator(nodes.NodeVisitor):
pass
def depart_target(self, node):
self.add_text(' (%s)' % node['refuri'])
# Reno produces anchor references for sections automatically
# now, and those don't have URIs set up so we want to ignore
# them. If we do have another target that does have a URI we
# want to include that, so test whether we have the URI before
# including the target info in the output.
if 'refuri' in node:
self.add_text(' (%s)' % node['refuri'])
def visit_index(self, node):
raise nodes.SkipNode