diff options
| author | John MacFarlane <[email protected]> | 2023-03-07 17:04:58 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-03-07 17:04:58 -0800 |
| commit | dd50fef01f5effb415e0c62a5345a0ab4eb14769 (patch) | |
| tree | 859965ae02a62944ad3f1ac581363bd948eb624c /src | |
| parent | 5f82c4fd107436b6c8ed001f4edce1a57abb77a6 (diff) | |
ICML writer: fix images with data.
The Contents element should be inside Properties. Closes #8675.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Writers/ICML.hs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs index a35699b46..8ee45f6c6 100644 --- a/src/Text/Pandoc/Writers/ICML.hs +++ b/src/Text/Pandoc/Writers/ICML.hs @@ -628,13 +628,19 @@ 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' + + isdata = "data:" `Text.isPrefixOf` src' && "base64," `Text.isInfixOf` src' + contents = + if isdata then -- see #8398 inTags True "Contents" [] $ - literal ("<![CDATA[" <> - Text.drop 1 (Text.dropWhile (/=',') src') <> "]]>") - else selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')] - + literal ("<![CDATA[" <> Text.replace "%20" "" + (Text.drop 1 (Text.dropWhile (/=',') src')) <> "]]>") + else mempty + link = if isdata + then mempty + else selfClosingTag "Link" [("Self", "ueb"), + ("LinkResourceURI", src')] image = inTags True "Image" [("Self","ue6"), ("ItemTransform", scale<>" -"<>hw<>" -"<>hh)] $ vcat [ @@ -643,8 +649,9 @@ imageICML opts style attr (src, _) = do , selfClosingTag "GraphicBounds" [("Left","0"), ("Top","0") , ("Right", showFl $ ow*ow / imgWidth) , ("Bottom", showFl $ oh*oh / imgHeight)] + , contents ] - , img + , link ] doc = inTags True "CharacterStyleRange" attrs $ inTags True "Rectangle" [("Self","uec"), ("StrokeWeight", "0"), |
