Skip to content

Commit

Permalink
Fix: Add document name when no {doc} text is provided (#102)
Browse files Browse the repository at this point in the history
* update doc roles to use document title from the environment

* add conditiont to expand target if node == targetdoc name
  • Loading branch information
mmcky committed Apr 19, 2021
1 parent f772bb0 commit b0ad3da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sphinx_tomyst/writers/translator.py
Expand Up @@ -1329,8 +1329,10 @@ def visit_pending_xref(self, node):
if reftype == "eq":
content = "{}".format(target)
elif reftype == "doc":
docname = node["refdoc"]
linktext = self.builder.env.longtitles[docname].astext()
targetname = node["reftarget"]
if linktext == targetname:
# Update linktext to be the title of the target document
linktext = self.builder.env.longtitles[targetname].astext()
content = "{} <{}>".format(linktext, target)
else:
# ref
Expand Down

0 comments on commit b0ad3da

Please sign in to comment.