From 4a1c52a1eefaf5bb163381f9f911aacb9d2c1bd4 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 25 Apr 2018 15:03:15 -0400 Subject: [PATCH] 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 --- releasetools/rst2txt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/releasetools/rst2txt.py b/releasetools/rst2txt.py index abebc72..0061286 100644 --- a/releasetools/rst2txt.py +++ b/releasetools/rst2txt.py @@ -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