diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2011-10-27 13:58:10 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2011-10-27 13:58:10 -0700 |
commit | 565113fb6b91ecaf1827110a53df923d9ef36789 (patch) | |
tree | 38f80b6337ff6b8d31a8b2e55793b6c12d1ca963 /src | |
parent | 40cb070fe61f7f3e90b184b869df0186947f3cb5 (diff) | |
download | pandoc-565113fb6b91ecaf1827110a53df923d9ef36789.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Biblio.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs index d65c9de1c..3182d7d0b 100644 --- a/src/Text/Pandoc/Biblio.hs +++ b/src/Text/Pandoc/Biblio.hs @@ -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 |