git.iko.soy/typeable/pandoc
on master help sign in
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.

commit565113fb6b91ecaf1827110a53df923d9ef36789 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 27 Oct 2011, 13:58 (15 years ago) parent40cb070
1 file changed+6−2
src/Text/Pandoc/Biblio.hs+6−2
src/Text/Pandoc/Biblio.hs+6−2
@@ -182,9 +182,13 @@ toCslCite c
182182
183183locatorWords :: [Inline] -> (String, [Inline])
184184locatorWords inp =
185− case parse pLocatorWords "suffix" inp of
185+ case parse pLocatorWords "suffix" $ breakup inp of
186186 Right r -> r
187187 Left _ -> ("",inp)
188+ where breakup [] = []
189+ breakup (Str x : xs) = map Str (splitup x) ++ breakup xs
190+ breakup (x : xs) = x : breakup xs
191+ splitup = groupBy (\x y -> x /= '\160' && y /= '\160')
188192
189193pLocatorWords :: GenParser Inline st (String, [Inline])
190194pLocatorWords = do
@@ -201,7 +205,7 @@ pMatch condition = try $ do
201205 return t
202206
203207pSpace :: GenParser Inline st Inline
204−pSpace = pMatch (== Space)
208+pSpace = pMatch (\t -> t == Space || t == Str "\160")
205209
206210pLocator :: GenParser Inline st String
207211pLocator = try $ do