Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-11-15 13:44:39 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-03-05 20:01:05 +0300
commitd99132680d277db8409d17195948ee1d422dca66 (patch)
treeab5ec3a2f5cabe16358d1e03f57ae419b1a7ba39 /sphinx/util
parente1130972b2ad2e57db4ebe0a6fa83e1cb76aa6a3 (diff)
Filter pending_xref_condition node on failed resolution
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/nodes.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 944fd3ecb..22cc9d4c0 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -531,6 +531,16 @@ def make_id(env: "BuildEnvironment", document: nodes.document,
return node_id
+def find_pending_xref_condition(node: addnodes.pending_xref, condition: str) -> Element:
+ """Pick matched pending_xref_condition node up from the pending_xref."""
+ for subnode in node:
+ if (isinstance(subnode, addnodes.pending_xref_condition) and
+ subnode.get('condition') == condition):
+ return subnode
+ else:
+ return None
+
+
def make_refnode(builder: "Builder", fromdocname: str, todocname: str, targetid: str,
child: Node, title: str = None) -> nodes.reference:
"""Shortcut to create a reference node."""