From 0cfd764d27bc03b59871e477d6bfd7341f4916b0 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 24 Nov 2017 12:17:20 +0300 Subject: Muse: move inline list normalization to writer --- src/Text/Pandoc/Writers/Muse.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index a6ef28ba7..ed5ad5793 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -291,11 +291,19 @@ conditionalEscapeString s = then escapeString s else s +normalizeInlineList :: [Inline] -> [Inline] +normalizeInlineList (Code a1 x1 : Code a2 x2 : ils) | a1 == a2 + = normalizeInlineList $ Code a1 (x1 ++ x2) : ils +normalizeInlineList (RawInline f1 x1 : RawInline f2 x2 : ils) | f1 == f2 + = normalizeInlineList $ RawInline f1 (x1 ++ x2) : ils +normalizeInlineList (x:xs) = x : normalizeInlineList xs +normalizeInlineList [] = [] + -- | Convert list of Pandoc inline elements to Muse. inlineListToMuse :: PandocMonad m => [Inline] -> StateT WriterState m Doc -inlineListToMuse lst = liftM hcat (mapM inlineToMuse lst) +inlineListToMuse lst = liftM hcat (mapM inlineToMuse (normalizeInlineList lst)) -- | Convert Pandoc inline element to Muse. inlineToMuse :: PandocMonad m -- cgit v1.2.3