File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,18 @@ class WrapTableAndMathInAContainerTransform(SphinxPostTransform):
44
44
45
45
def run (self , ** kwargs : Any ) -> None :
46
46
"""Perform the post-transform on `self.document`."""
47
- for node in list (self .document .findall (nodes .table )):
47
+ get_nodes = (
48
+ self .document .findall # docutils 0.18+
49
+ if hasattr (self .document , "findall" )
50
+ else self .document .traverse # docutils <= 0.17.x
51
+ )
52
+ for node in list (get_nodes (nodes .table )):
48
53
new_node = nodes .container (classes = ["table-wrapper" ])
49
54
new_node .update_all_atts (node )
50
55
node .parent .replace (node , new_node )
51
56
new_node .append (node )
52
57
53
- for node in list (self . document . findall (nodes .math_block )):
58
+ for node in list (get_nodes (nodes .math_block )):
54
59
new_node = nodes .container (classes = ["math-wrapper" ])
55
60
new_node .update_all_atts (node )
56
61
node .parent .replace (node , new_node )
You can’t perform that action at this time.
0 commit comments