diff options
| author | John MacFarlane <[email protected]> | 2022-10-26 09:05:09 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2022-10-26 09:05:09 -0700 |
| commit | b8047e350ce6917435db49bfa107994236373b51 (patch) | |
| tree | 58fbd25a2b7ffc241c5f1fbcde1e658d5ea9998a | |
| parent | 031420b2d2f5d70e4a043f6ae27db5881e666923 (diff) | |
ICML writer: use Contents element for images with raw data...
instead of a link with a data: uri.
Closes #8398.
| -rw-r--r-- | src/Text/Pandoc/Writers/ICML.hs | 9 |
1 files changed, 8 insertions, 1 deletions
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 ("<![CDATA[" <> + 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"), |
