From f807f5b3833e841d9e6b831acbe50f3be8e42881 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sat, 25 May 2019 19:13:28 +0300 Subject: Muse reader: allow images inside link descriptions --- src/Text/Pandoc/Readers/Muse.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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 -- cgit v1.2.3