aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-01-09 11:25:24 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-01-09 11:25:24 -0800
commitb9b1546ed238ca8fd4d65a6e02fa7ecbf9a4be65 (patch)
tree3aa1c421c4bc255c702e0dcde2a55558deba8ab5 /src/Text
parent5c8c380a7997156964a5402974f6f464233aab9b (diff)
downloadpandoc-b9b1546ed238ca8fd4d65a6e02fa7ecbf9a4be65.tar.gz
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.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs7
1 files changed, 4 insertions, 3 deletions
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)