Skip to content

Commit

Permalink
Fix dropTextWhile and dropTextWhileEnd in Citeproc.Pandoc.
Browse files Browse the repository at this point in the history
Ensure that they treat SoftBreak like Space.
See jgm/pandoc#10451.
  • Loading branch information
jgm committed Dec 10, 2024
1 parent 0c080ae commit cc84ef0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Citeproc/Pandoc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ dropTextWhile' f ils = evalState (walkM go ils) True
unless (T.null t') $
put False
return $ Str t'
Space ->
_ | x == Space || x == SoftBreak ->
if f ' '
then return $ Str ""
else do
put False
return Space
_ -> return x
| otherwise -> return x
else return x


Expand All @@ -185,8 +185,9 @@ dropTextWhileEnd' f ils =
unless (T.null t') $
put False
return $ Str t'
Space | f ' ' -> return $ Str ""
_ -> return x
_ | x == Space || x == SoftBreak
, f ' ' -> return $ Str ""
| otherwise -> return x
else return x

-- taken from Text.Pandoc.Shared:
Expand Down

0 comments on commit cc84ef0

Please sign in to comment.