From 0aab0b6bf21b2414256e3416c807a9acdab88c46 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 10 Jun 2022 19:44:25 -0400 Subject: [PATCH] fix links in sphinx directive --- dargs/sphinx.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dargs/sphinx.py b/dargs/sphinx.py index 487050a..6baab54 100644 --- a/dargs/sphinx.py +++ b/dargs/sphinx.py @@ -85,8 +85,15 @@ def run(self): if not isinstance(argument, (Argument, Variant)): raise RuntimeError("The function doesn't return Argument") rst = argument.gen_doc(make_anchor=True, make_link=True) - items.extend(parse_rst(rst)) - + node = parse_rst(rst) + self.state.document.nameids.update(node.nameids) + self.state.document.ids.update(node.ids) + self.state.document.refnames.update(node.refnames) + self.state.document.substitution_defs.update(node.substitution_defs) + self.state.document.substitution_names.update(node.substitution_names) + self.state.document.nametypes.update(node.nametypes) + self.state.document.indirect_targets.extend(node.indirect_targets) + items.extend(node) return items