Skip to content

Commit

Permalink
Fix bug introduced in f7b2e69.
Browse files Browse the repository at this point in the history
Here checking exactly for Block is important; classes derived
from Block must not match.
  • Loading branch information
felixfontein committed Nov 2, 2024
1 parent 4aafd62 commit e1e832a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions v7/latex/latex/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,12 @@ def __flatten(self, block):
if isinstance(block, tree.Block):
while True:
if len(block.elements) == 1 and isinstance(block.elements[0], tree.Block):
if isinstance(block, tree.Block):
# Note that the two if conditions below cannot use isinstance()
# since we do not want to match any class derived from Block!
if type(block) == tree.Block:
block.elements[0].labels.extend(block.labels)
block = block.elements[0]
elif isinstance(block.elements[0], tree.Block):
elif type(block.elements[0]) == tree.Block:
block.labels.extend(block.elements[0].labels)
block.elements = block.elements[0].elements
else:
Expand Down

0 comments on commit e1e832a

Please sign in to comment.