git.iko.soy/typeable/pandoc
on master help sign in
Biblio: If locator ends with ",", add it to the suffix.
eac4abeJohn MacFarlane
src/Text/Pandoc/Biblio.hs+9−1
@@ -174,10 +174,18 @@ toCslCite c
174
174
175locatorWords :: [Inline] -> (String, [Inline])
175locatorWords :: [Inline] -> (String, [Inline])
176locatorWords inp =
176locatorWords inp =
177− case parse (liftM2 (,) pLocator getInput) "suffix" inp of
177+ case parse pLocatorWords "suffix" inp of
178 Right r -> r
178 Right r -> r
179 Left _ -> ("",inp)
179 Left _ -> ("",inp)
180
180
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+
181pMatch :: (Inline -> Bool) -> GenParser Inline st Inline
189pMatch :: (Inline -> Bool) -> GenParser Inline st Inline
182pMatch condition = try $ do
190pMatch condition = try $ do
183 t <- anyToken
191 t <- anyToken