Skip to content

Commit

Permalink
Amend inefficiency in splitMath
Browse files Browse the repository at this point in the history
Closes #445
  • Loading branch information
lierdakil committed Aug 31, 2024
1 parent f15f77c commit 69eba7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib-internal/Text/Pandoc/CrossRef/References/Blocks/Math.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ replaceEqn eqTemplate (label, _, attrs) eq = do

splitMath :: [Block] -> [Block]
splitMath (Para ils:xs)
| length ils > 1 = map Para (split [] [] ils) <> xs
| _:_:_ <- ils -- at least two elements
= map Para (split [] [] ils) <> xs
where
split res acc [] = reverse (reverse acc : res)
split res acc (x@(Span _ [Math DisplayMath _]):ys) =
Expand Down

0 comments on commit 69eba7f

Please sign in to comment.