From bc0025d944d936ab4f311e10992b7c5802424446 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Tue, 20 Mar 2018 13:20:01 +0300 Subject: Muse writer: remove key-value pairs from attributes before normalization --- src/Text/Pandoc/Writers/Muse.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs index eb1821922..b64756f91 100644 --- a/src/Text/Pandoc/Writers/Muse.hs +++ b/src/Text/Pandoc/Writers/Muse.hs @@ -312,6 +312,13 @@ replaceSmallCaps :: Inline -> Inline replaceSmallCaps (SmallCaps lst) = Emph lst replaceSmallCaps x = x +removeKeyValues :: Inline -> Inline +removeKeyValues (Code (i, cls, _) xs) = Code (i, cls, []) xs +-- Do not remove attributes from Link +-- Do not remove attributes, such as "width", from Image +removeKeyValues (Span (i, cls, _) xs) = Span (i, cls, []) xs +removeKeyValues x = x + normalizeInlineList :: [Inline] -> [Inline] normalizeInlineList (Str "" : xs) = normalizeInlineList xs @@ -356,7 +363,7 @@ inlineListToMuse :: PandocMonad m => [Inline] -> StateT WriterState m Doc inlineListToMuse lst = do - lst' <- normalizeInlineList <$> preprocessInlineList (map replaceSmallCaps lst) + lst' <- normalizeInlineList <$> preprocessInlineList (map (removeKeyValues . replaceSmallCaps) lst) if null lst' then pure "" else hcat <$> mapM inlineToMuse (fixNotes lst') -- cgit v1.2.3