aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2019-05-25 19:13:28 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2019-05-25 19:17:16 +0300
commitf807f5b3833e841d9e6b831acbe50f3be8e42881 (patch)
tree5fb9849e69235bb68fce129f5758ca954caac00d /src/Text/Pandoc
parent751427745417c7702a1546b1368db297a44b21e0 (diff)
downloadpandoc-f807f5b3833e841d9e6b831acbe50f3be8e42881.tar.gz
Muse reader: allow images inside link descriptions
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/Muse.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs
index fa19ea767..568287929 100644
--- a/src/Text/Pandoc/Readers/Muse.hs
+++ b/src/Text/Pandoc/Readers/Muse.hs
@@ -903,10 +903,7 @@ symbol = pure . B.str . pure <$> nonspaceChar
-- | Parse a link or image.
linkOrImage :: PandocMonad m => MuseParser m (F Inlines)
-linkOrImage = try $ do
- inLink <- asks museInLink
- guard $ not inLink
- local (\s -> s { museInLink = True }) (link "URL:" <|> image <|> link "")
+linkOrImage = try $ link "URL:" <|> image <|> link ""
linkContent :: PandocMonad m => MuseParser m (F Inlines)
linkContent = trimInlinesF . mconcat
@@ -916,9 +913,11 @@ linkContent = trimInlinesF . mconcat
-- | Parse a link starting with (possibly null) prefix
link :: PandocMonad m => String -> MuseParser m (F Inlines)
link prefix = try $ do
+ inLink <- asks museInLink
+ guard $ not inLink
string $ "[[" ++ prefix
url <- manyTill anyChar $ char ']'
- content <- option (pure $ B.str url) linkContent
+ content <- option (pure $ B.str url) (local (\s -> s { museInLink = True }) linkContent)
char ']'
return $ B.link url "" <$> content