From b8047e350ce6917435db49bfa107994236373b51 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 26 Oct 2022 09:05:09 -0700 Subject: ICML writer: use Contents element for images with raw data... instead of a link with a data: uri. Closes #8398. --- src/Text/Pandoc/Writers/ICML.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs index 8a3af73c3..0d229a040 100644 --- a/src/Text/Pandoc/Writers/ICML.hs +++ b/src/Text/Pandoc/Writers/ICML.hs @@ -621,6 +621,13 @@ imageICML opts style attr (src, _) = do , selfClosingTag "PathPointType" [("Anchor", hw<>" -"<>hh), ("LeftDirection", hw<>" -"<>hh), ("RightDirection", hw<>" -"<>hh)] ] + img = if "data:" `Text.isPrefixOf` src' && "base64," `Text.isInfixOf` src' + then -- see #8398 + inTags True "Contents" [] $ + literal (" + Text.drop 1 (Text.dropWhile (/=',') src') <> "]]>") + else selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')] + image = inTags True "Image" [("Self","ue6"), ("ItemTransform", scale<>" -"<>hw<>" -"<>hh)] $ vcat [ @@ -630,7 +637,7 @@ imageICML opts style attr (src, _) = do , ("Right", showFl $ ow*ow / imgWidth) , ("Bottom", showFl $ oh*oh / imgHeight)] ] - , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')] + , img ] doc = inTags True "CharacterStyleRange" attrs $ inTags True "Rectangle" [("Self","uec"), ("StrokeWeight", "0"), -- cgit v1.2.3