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

View File

@ -813,7 +813,13 @@ class TextTranslator(nodes.NodeVisitor):
pass pass
def depart_target(self, node): 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): def visit_index(self, node):
raise nodes.SkipNode raise nodes.SkipNode