diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2011-11-06 16:00:23 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2011-11-06 16:00:23 -0800 |
commit | dd6ed8870790a14e26ace30a90430776b3c55df2 (patch) | |
tree | 31d91ae98572fd31dba7a4dbe9468c6f66407eb6 | |
parent | e8bfabeeeb5f30b2f940e3ee505e938d94486abe (diff) | |
download | pandoc-dd6ed8870790a14e26ace30a90430776b3c55df2.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 |
1 files changed, 2 insertions, 1 deletions
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 |