Biblio: Treat \160 as space when parsing locator and suffix.
This fixes a bug with "p. 33" when `--smart` is used. Previously the whole "p. 33" would be included in the suffix, with no locator.
This commit is contained in:
parent
40cb070fe6
commit
565113fb6b
1 changed files with 6 additions and 2 deletions
|
@ -182,9 +182,13 @@ toCslCite c
|
|||
|
||||
locatorWords :: [Inline] -> (String, [Inline])
|
||||
locatorWords inp =
|
||||
case parse pLocatorWords "suffix" inp of
|
||||
case parse pLocatorWords "suffix" $ breakup inp of
|
||||
Right r -> r
|
||||
Left _ -> ("",inp)
|
||||
where breakup [] = []
|
||||
breakup (Str x : xs) = map Str (splitup x) ++ breakup xs
|
||||
breakup (x : xs) = x : breakup xs
|
||||
splitup = groupBy (\x y -> x /= '\160' && y /= '\160')
|
||||
|
||||
pLocatorWords :: GenParser Inline st (String, [Inline])
|
||||
pLocatorWords = do
|
||||
|
@ -201,7 +205,7 @@ pMatch condition = try $ do
|
|||
return t
|
||||
|
||||
pSpace :: GenParser Inline st Inline
|
||||
pSpace = pMatch (== Space)
|
||||
pSpace = pMatch (\t -> t == Space || t == Str "\160")
|
||||
|
||||
pLocator :: GenParser Inline st String
|
||||
pLocator = try $ do
|
||||
|
|
Loading…
Add table
Reference in a new issue