From 1fa2973da690ba81a80337d9d3f0f6e2c786b602 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 12 Nov 2010 19:30:59 -0800 Subject: Repairs to citation parser + citation test suite. --- src/Text/Pandoc/Readers/Markdown.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index eb9646df2..0d0e850bc 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1332,9 +1332,9 @@ textualCite = try $ do spnl char '[' spnl - bareloc <- option "" locator + bareloc <- option "" $ notFollowedBy (oneOf "-@") >> locator rest <- many $ try $ do - char ';' + optional $ char ';' spnl citation spnl @@ -1366,10 +1366,10 @@ locator = try $ do (char '\n' >> notFollowedBy blankline >> return ' ') prefix :: GenParser Char st String -prefix = try $ liftM removeLeadingTrailingSpace $ - many $ (char '\\' >> anyChar) <|> noneOf "@]\n" <|> - (char '-' >> notFollowedBy (char '@') >> return '-') <|> - (char '\n' >> notFollowedBy blankline >> return ' ') +prefix = liftM removeLeadingTrailingSpace $ + many $ (char '\\' >> anyChar) <|> noneOf "-@]\n" <|> + (try $ char '-' >> notFollowedBy (char '@') >> return '-') <|> + (try $ char '\n' >> notFollowedBy blankline >> return ' ') citeList :: GenParser Char st [Citation] citeList = try $ do @@ -1387,10 +1387,10 @@ citeList = try $ do citation :: GenParser Char st Citation citation = try $ do - suppress_auth <- option False (char '-' >> return True) pref <- prefix + suppress_auth <- option False (char '-' >> return True) key <- citeKey - loc <- locator + loc <- option "" locator return $ Citation{ citationId = key , citationPrefix = pref , citationLocator = loc -- cgit v1.2.3