From b9b1546ed238ca8fd4d65a6e02fa7ecbf9a4be65 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 9 Jan 2014 11:25:24 -0800 Subject: Markdown parser: be more permissive about citation keys. Keys may now start with an underscore as well as a letter. Underscores do not count as internal punctuation, but are treated like alphanumerics, so "key:_2008" will work, as it did not before. (This change was necessary to use keys generated by zotero.) Closes #1111, closes #1011. --- src/Text/Pandoc/Readers/Markdown.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 88d0bf439..3feafd362 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1811,9 +1811,10 @@ citeKey = try $ do guard $ lastStrPos /= Just pos suppress_author <- option False (char '-' >> return True) char '@' - first <- letter - let internal p = try $ p >>~ lookAhead (letter <|> digit) - rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_+?<>~/") + first <- letter <|> char '_' + let regchar = satisfy (\c -> isAlphaNum c || c == '_') + let internal p = try $ p >>~ lookAhead regchar + rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/") let key = first:rest return (suppress_author, key) -- cgit v1.2.3