From dd6ed8870790a14e26ace30a90430776b3c55df2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 6 Nov 2011 16:00:23 -0800 Subject: Markdown reader: allow punctuation only internally in cite keys. The characters '.',':',';','$','<','>','~','#','-','_' can be used only between two letters or digits in a citation key. This means that '@item1.' will be parsed as a citation, 'item1', followed by a period, instead of a citation 'item1.', as was the case previously. Thanks to David Sanson for alerting us to the problem. --- src/Text/Pandoc/Readers/Markdown.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 53531dc1a..f04ea88c4 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1312,7 +1312,8 @@ citeKey = try $ do suppress_author <- option False (char '-' >> return True) char '@' first <- letter - rest <- many $ (noneOf ",;!?[]()@ \t\n") + let internal p = try $ p >>~ lookAhead (letter <|> digit) + rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_?<>~") let key = first:rest st <- getState guard $ key `elem` stateCitations st -- cgit v1.2.3