aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-15 10:50:10 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-15 10:54:12 -0800
commita5cac0a0c401b0d5c901ac734c877f6a32bddb40 (patch)
tree78b2b46d898898cd308c2fb931ad6560b662584e /src/Text
parent9bf76fa5a256a20d03d251ec15f1785af9a7bb41 (diff)
downloadpandoc-a5cac0a0c401b0d5c901ac734c877f6a32bddb40.tar.gz
Don't treat a citation as a reference link label.
Closes #1763.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs7
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'