mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-20 22:46:06 +00:00
Shared: use short-circuiting 'any' in compactify
Replace list comprehension filters (which materialize the full list) with 'any isPara', allowing early exit on the first match. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
8b17e1c66d
commit
89fcb01a58
@@ -412,9 +412,9 @@ compactify items =
|
||||
let (others, final) = (init items, last items)
|
||||
in case reverse (B.toList final) of
|
||||
(Para a:xs)
|
||||
| null [Para x | Para x <- xs ++ concatMap B.toList others]
|
||||
| not (any isPara xs || any (any isPara . B.toList) others)
|
||||
-> others ++ [B.fromList (reverse (Plain a : xs))]
|
||||
_ | null [Para x | Para x <- concatMap B.toList items]
|
||||
_ | not (any (any isPara . B.toList) items)
|
||||
-> items
|
||||
_ -> map (fmap plainToPara) items
|
||||
|
||||
|
||||
Reference in New Issue
Block a user