aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index d59f8a71a..2d3ad1199 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1332,9 +1332,6 @@ noneOfUnlessEscaped cs =
textualCite :: GenParser Char ParserState [Citation]
textualCite = try $ do
(_, key) <- citeKey
- st <- getState
- unless (key `elem` stateCitations st) $
- fail "not a citation"
let first = Citation{ citationId = key
, citationPrefix = []
, citationSuffix = []
@@ -1368,13 +1365,16 @@ normalCite = try $ do
char ']'
return citations
-citeKey :: GenParser Char st (Bool, String)
+citeKey :: GenParser Char ParserState (Bool, String)
citeKey = try $ do
suppress_author <- option False (char '-' >> return True)
char '@'
first <- letter
rest <- many $ (noneOf ",;]@ \t\n")
- return (suppress_author, first:rest)
+ let key = first:rest
+ st <- getState
+ guard $ key `elem` stateCitations st
+ return (suppress_author, key)
locator :: GenParser Char st String
locator = try $ do