aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 2336c430f..93806f18f 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -818,23 +818,20 @@ title = choice [ titleWith '(' ')',
titleWith '"' '"',
titleWith '\'' '\''] <?> "title"
-link = choice [explicitLink, referenceLink] <?> "link"
-
-explicitLink = try $ do
+link = try $ do
label <- reference
- src <- source
+ src <- source <|> referenceLink label
return $ Link label src
-- a link like [this][ref] or [this][] or [this]
-referenceLink = try $ do
- label <- reference
+referenceLink label = do
ref <- option [] (try (skipSpaces >> optional newline >>
skipSpaces >> reference))
let ref' = if null ref then label else ref
state <- getState
case lookupKeySrc (stateKeys state) ref' of
Nothing -> fail "no corresponding key"
- Just target -> return (Link label target)
+ Just target -> return target
autoLink = autoLinkEmail <|> autoLinkRegular