diff options
author | Alexander Krotov <ilabdsf@gmail.com> | 2018-03-20 13:20:01 +0300 |
---|---|---|
committer | Alexander Krotov <ilabdsf@gmail.com> | 2018-03-20 14:51:39 +0300 |
commit | bc0025d944d936ab4f311e10992b7c5802424446 (patch) | |
tree | be9a5a259e7abfbcb90a54a0bcae476dac015195 | |
parent | 268c73c873b93daf3321d38d659be7849579c7f0 (diff) | |
download | pandoc-bc0025d944d936ab4f311e10992b7c5802424446.tar.gz |
Muse writer: remove key-value pairs from attributes before normalization
-rw-r--r-- | src/Text/Pandoc/Writers/Muse.hs | 9 |
1 files changed, 8 insertions, 1 deletions
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 "<verbatim></verbatim>" else hcat <$> mapM inlineToMuse (fixNotes lst') |