aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2021-09-27 16:48:46 -0700
committerJohn MacFarlane <[email protected]>2021-09-29 08:37:08 -0700
commita1df872aed9d804ca99d4bc74600a56c7eae9324 (patch)
treec69e1b05951ba698ca304ceda997bf51209942cc
parent88164609ce5b1f6a593e4621d9513a839bf56b85 (diff)
More.
-rw-r--r--src/Text/Pandoc/Citeproc/BibTeX.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Citeproc/BibTeX.hs b/src/Text/Pandoc/Citeproc/BibTeX.hs
index b854e82c0..3fc0308f8 100644
--- a/src/Text/Pandoc/Citeproc/BibTeX.hs
+++ b/src/Text/Pandoc/Citeproc/BibTeX.hs
@@ -1209,7 +1209,7 @@ toName opts ils = do
let useprefix = optionSet "useprefix" opts
let usecomma = optionSet "juniorcomma" opts
let bibtex = optionSet "bibtex" opts
- let words' = wordsBy (\x -> x == ' ' || x == Str "\160")
+ let words' = wordsBy (\x -> x == Str " " || x == Str "\160")
let commaParts = map words' $ splitWhen (== Str ",")
$ splitStrWhen
(\c -> c == ',' || c == '\160') ils
@@ -1261,13 +1261,14 @@ toName opts ils = do
, nameStaticOrdering = False
}
--- Split Str elements so that characters satisfying the
--- predicate each have their own Str.
+-- Put p's (and spaces) in their own Str elements.
splitStrWhen :: (Char -> Bool) -> [Inline] -> [Inline]
splitStrWhen p = foldr go []
where
go (Str t) = (map Str (T.groupBy goesTogether t) ++)
go x = (x :)
+ goesTogether ' ' _ = False
+ goesTogether _ ' ' = False
goesTogether c d = not (p c || p d)
ordinalize :: Locale -> Text -> Text