git.iko.soy/typeable/pandoc
on master help sign in
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.

commitb9b1546ed238ca8fd4d65a6e02fa7ecbf9a4be65 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 9 Jan 2014, 11:25 (13 years ago) parent5c8c380
1 file changed+4−3
src/Text/Pandoc/Readers/Markdown.hs+4−3
src/Text/Pandoc/Readers/Markdown.hs+4−3
@@ -1811,9 +1811,10 @@ citeKey = try $ do
18111811 guard $ lastStrPos /= Just pos
18121812 suppress_author <- option False (char '-' >> return True)
18131813 char '@'
1814− first <- letter
1815− let internal p = try $ p >>~ lookAhead (letter <|> digit)
1816− rest <- many $ letter <|> digit <|> internal (oneOf ":.#$%&-_+?<>~/")
1814+ first <- letter <|> char '_'
1815+ let regchar = satisfy (\c -> isAlphaNum c || c == '_')
1816+ let internal p = try $ p >>~ lookAhead regchar
1817+ rest <- many $ regchar <|> internal (oneOf ":.#$%&-+?<>~/")
18171818 let key = first:rest
18181819 return (suppress_author, key)
18191820