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:20:30 -04:00
parent 5b349efe1e
commit 6cf9010df5

View File

@ -813,6 +813,12 @@ class TextTranslator(nodes.NodeVisitor):
pass pass
def depart_target(self, node): def depart_target(self, node):
# 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']) self.add_text(' (%s)' % node['refuri'])
def visit_index(self, node): def visit_index(self, node):