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.
This commit is contained in:
parent
5c8c380a79
commit
b9b1546ed2
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue