git.iko.soy/typeable/pandoc
on master help sign in
Biblio: If locator ends with ",", add it to the suffix.
commiteac4abe36f705b852726eeceee928eb9ead6ceb0 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 27 Nov 2010, 11:28 (16 years ago) parent219853b
1 file changed+9−1
src/Text/Pandoc/Biblio.hs+9−1
src/Text/Pandoc/Biblio.hs+9−1
@@ -174,10 +174,18 @@ toCslCite c
174174
175175locatorWords :: [Inline] -> (String, [Inline])
176176locatorWords inp =
177− case parse (liftM2 (,) pLocator getInput) "suffix" inp of
177+ case parse pLocatorWords "suffix" inp of
178178 Right r -> r
179179 Left _ -> ("",inp)
180180
181+pLocatorWords :: GenParser Inline st (String, [Inline])
182+pLocatorWords = do
183+ l <- pLocator
184+ s <- getInput -- rest is suffix
185+ if length l > 0 && last l == ','
186+ then return (init l, Str "," : s)
187+ else return (l, s)
188+
181189pMatch :: (Inline -> Bool) -> GenParser Inline st Inline
182190pMatch condition = try $ do
183191 t <- anyToken