summaryrefslogtreecommitdiff
path: root/sphinx/util/nodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/nodes.py')
-rw-r--r--sphinx/util/nodes.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 7ce0933c6..78663e4c7 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -589,14 +589,16 @@ NON_SMARTQUOTABLE_PARENT_NODES = (
def is_smartquotable(node: Node) -> bool:
"""Check whether the node is smart-quotable or not."""
- if isinstance(node.parent, NON_SMARTQUOTABLE_PARENT_NODES):
- return False
- elif node.parent.get('support_smartquotes', None) is False:
- return False
- elif getattr(node, 'support_smartquotes', None) is False:
+ for pnode in traverse_parent(node.parent):
+ if isinstance(pnode, NON_SMARTQUOTABLE_PARENT_NODES):
+ return False
+ elif pnode.get('support_smartquotes', None) is False:
+ return False
+
+ if getattr(node, 'support_smartquotes', None) is False:
return False
- else:
- return True
+
+ return True
def process_only_nodes(document: Node, tags: "Tags") -> None: