From 9cc2bf0295a66182223c9ec421a4755d1acebeb1 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 15 Apr 2018 14:50:46 +0300 Subject: Muse reader: allow URL to be empty Muse writer can write links with empty URLs, so Muse reader should read them. --- src/Text/Pandoc/Readers/Muse.hs | 2 +- test/Tests/Readers/Muse.hs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Readers/Muse.hs b/src/Text/Pandoc/Readers/Muse.hs index 0da8bbdcc..0dba0c4cb 100644 --- a/src/Text/Pandoc/Readers/Muse.hs +++ b/src/Text/Pandoc/Readers/Muse.hs @@ -972,7 +972,7 @@ linkContent = char '[' >> trimInlinesF . mconcat <$> manyTill inline (string "]" linkText :: PandocMonad m => MuseParser m (String, Maybe (F Inlines)) linkText = do string "[[" - url <- many1Till anyChar $ char ']' + url <- manyTill anyChar $ char ']' content <- optionMaybe linkContent char ']' return (url, content) diff --git a/test/Tests/Readers/Muse.hs b/test/Tests/Readers/Muse.hs index 188036a09..11ec9464f 100644 --- a/test/Tests/Readers/Muse.hs +++ b/test/Tests/Readers/Muse.hs @@ -209,6 +209,7 @@ tests = -- This test also makes sure '=' without whitespace is not treated as code markup , "No implicit links" =: "http://example.org/index.php?action=view&id=1" =?> para "http://example.org/index.php?action=view&id=1" + , "Link with empty URL" =: "[[][empty URL]]" =?> para (link "" "" (text "empty URL")) ] , testGroup "Literal" -- cgit v1.2.3