diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-11-27 11:28:28 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-11-27 11:28:45 -0800 |
commit | eac4abe36f705b852726eeceee928eb9ead6ceb0 (patch) | |
tree | 27828fd2cb4fc24c8d615c69035cec8a5d145d6a /src/Text/Pandoc/Biblio.hs | |
parent | 219853b05e37be8cda8527eff80ec4f505203c5d (diff) | |
download | pandoc-eac4abe36f705b852726eeceee928eb9ead6ceb0.tar.gz |
Biblio: If locator ends with ",", add it to the suffix.
Diffstat (limited to 'src/Text/Pandoc/Biblio.hs')
-rw-r--r-- | src/Text/Pandoc/Biblio.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs index 717084ca7..efaafd77d 100644 --- a/src/Text/Pandoc/Biblio.hs +++ b/src/Text/Pandoc/Biblio.hs @@ -174,10 +174,18 @@ toCslCite c locatorWords :: [Inline] -> (String, [Inline]) locatorWords inp = - case parse (liftM2 (,) pLocator getInput) "suffix" inp of + case parse pLocatorWords "suffix" inp of Right r -> r Left _ -> ("",inp) +pLocatorWords :: GenParser Inline st (String, [Inline]) +pLocatorWords = do + l <- pLocator + s <- getInput -- rest is suffix + if length l > 0 && last l == ',' + then return (init l, Str "," : s) + else return (l, s) + pMatch :: (Inline -> Bool) -> GenParser Inline st Inline pMatch condition = try $ do t <- anyToken |