From 1e21cfb251506d42cbdcf3e24661f08633817572 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 19 Dec 2017 13:22:15 +0300 Subject: Muse writer: don't wrap note references to the next line Closes #4172. --- src/Text/Pandoc/Writers/Muse.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index ccda8edf1..545891d97 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -313,11 +313,17 @@ normalizeInlineList (Span a1 x1 : Span a2 x2 : ils) | a1 == a2 normalizeInlineList (x:xs) = x : normalizeInlineList xs normalizeInlineList [] = [] +fixNotes :: [Inline] -> [Inline] +fixNotes [] = [] +fixNotes (Space : n@Note{} : rest) = Str " " : n : fixNotes rest +fixNotes (SoftBreak : n@Note{} : rest) = Str " " : n : fixNotes rest +fixNotes (x:xs) = x : fixNotes xs + -- | Convert list of Pandoc inline elements to Muse. inlineListToMuse :: PandocMonad m => [Inline] -> StateT WriterState m Doc -inlineListToMuse lst = liftM hcat (mapM inlineToMuse (normalizeInlineList lst)) +inlineListToMuse lst = hcat <$> mapM inlineToMuse (fixNotes $ normalizeInlineList lst) -- | Convert Pandoc inline element to Muse. inlineToMuse :: PandocMonad m -- cgit v1.2.3