@@ -134,6 +134,7 @@ def __init__(self, node: Element) -> None:
134134 self .has_problematic = False
135135 self .has_oldproblematic = False
136136 self .has_verbatim = False
137+ self .entry_needs_linetrimming = 0
137138 self .caption : list [str ] = []
138139 self .stubs : list [int ] = []
139140
@@ -327,7 +328,6 @@ def __init__(
327328 self .in_footnote = 0
328329 self .in_caption = 0
329330 self .in_term = 0
330- self .needs_linetrimming = 0
331331 self .in_minipage = 0
332332 # only used by figure inside an admonition
333333 self .no_latex_floats = 0
@@ -1331,7 +1331,7 @@ def visit_entry(self, node: Element) -> None:
13311331 r'\par' + CR + r'\vskip-\baselineskip'
13321332 r'\vbox{\hbox{\strut}}\end{varwidth}%' + CR + context
13331333 )
1334- self .needs_linetrimming = 1
1334+ self .table . entry_needs_linetrimming = 1
13351335 if len (list (node .findall (nodes .paragraph ))) >= 2 :
13361336 self .table .has_oldproblematic = True
13371337 if (
@@ -1346,13 +1346,14 @@ def visit_entry(self, node: Element) -> None:
13461346 pass
13471347 else :
13481348 self .body .append (r'\sphinxstyletheadfamily ' )
1349- if self .needs_linetrimming :
1349+ if self .table . entry_needs_linetrimming :
13501350 self .pushbody ([])
13511351 self .context .append (context )
13521352
13531353 def depart_entry (self , node : Element ) -> None :
1354- if self .needs_linetrimming :
1355- self .needs_linetrimming = 0
1354+ assert self .table is not None
1355+ if self .table .entry_needs_linetrimming :
1356+ self .table .entry_needs_linetrimming = 0
13561357 body = self .popbody ()
13571358
13581359 # Remove empty lines from top of merged cell
@@ -1362,7 +1363,6 @@ def depart_entry(self, node: Element) -> None:
13621363
13631364 self .body .append (self .context .pop ())
13641365
1365- assert self .table is not None
13661366 cell = self .table .cell ()
13671367 assert cell is not None
13681368 self .table .col += cell .width
0 commit comments