diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-15 10:50:10 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-15 10:54:12 -0800 |
commit | a5cac0a0c401b0d5c901ac734c877f6a32bddb40 (patch) | |
tree | 78b2b46d898898cd308c2fb931ad6560b662584e /src/Text/Pandoc | |
parent | 9bf76fa5a256a20d03d251ec15f1785af9a7bb41 (diff) | |
download | pandoc-a5cac0a0c401b0d5c901ac734c877f6a32bddb40.tar.gz |
Don't treat a citation as a reference link label.
Closes #1763.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 2ca3b0eb6..187b479c3 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1675,9 +1675,10 @@ referenceLink :: (String -> String -> Inlines -> Inlines) -> (F Inlines, String) -> MarkdownParser (F Inlines) referenceLink constructor (lab, raw) = do sp <- (True <$ lookAhead (char ' ')) <|> return False - (ref,raw') <- try - (skipSpaces >> optional (newline >> skipSpaces) >> reference) - <|> return (mempty, "") + (ref,raw') <- option (mempty, "") $ + lookAhead (try (spnl >> normalCite >> return (mempty, ""))) + <|> + try (spnl >> reference) let labIsRef = raw' == "" || raw' == "[]" let key = toKey $ if labIsRef then raw else raw' parsedRaw <- parseFromString (mconcat <$> many inline) raw' |