From 9dbd59a7c120eee9a0bbe292a05dd144987fa0a0 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 2 Mar 2018 01:39:16 +0300 Subject: Muse writer: join strings during inline normalization --- src/Text/Pandoc/Writers/Muse.hs | 2 ++ test/Tests/Writers/Muse.hs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index 314e7a5c1..bf1f267fd 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -294,6 +294,8 @@ conditionalEscapeString s = normalizeInlineList :: [Inline] -> [Inline] normalizeInlineList (x : Str "" : xs) = normalizeInlineList (x:xs) +normalizeInlineList (Str x1 : Str x2 : xs) + = normalizeInlineList $ Str (x1 ++ x2) : xs normalizeInlineList (Emph x1 : Emph x2 : ils) = normalizeInlineList $ Emph (x1 ++ x2) : ils normalizeInlineList (Strong x1 : Strong x2 : ils) diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index a5a6986f2..0b8a08258 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -297,6 +297,7 @@ tests = [ testGroup "block elements" , "escape hash to avoid accidental anchors" =: text "#foo bar" =?> "#foo bar" , "escape definition list markers" =: str "::" =?> "::" + , "normalize strings before escaping" =: fromList [Str ":", Str ":"] =?> "::" -- We don't want colons to be escaped if they can't be confused -- with definition list item markers. , "do not escape colon" =: str ":" =?> ":" -- cgit v1.2.3