git.iko.soy/typeable/pandoc
on master help sign in
ICML writer: fix image bounding box for custom widths/heights

fixes #6936

commit208cb9619632ee9490b75158e44213ee6d4ab93e authormb21 <mb21@users.noreply.github.com> dateSat 12 Dec 2020, 14:12 (6 years ago) parentfcd0658
4 files changed+13−1
src/Text/Pandoc/Writers/ICML.hs+6−1 test/command/5541-nesting.md+1 test/command/svg.md+4 test/writer.icml+2
src/Text/Pandoc/Writers/ICML.hs+6−1
@@ -621,7 +621,12 @@ imageICML opts style attr (src, _) = do
621621 image = inTags True "Image"
622622 [("Self","ue6"), ("ItemTransform", scale<>" -"<>hw<>" -"<>hh)]
623623 $ vcat [
624− inTags True "Properties" [] $ inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
624+ inTags True "Properties" [] $ vcat [
625+ inTags True "Profile" [("type","string")] $ text "$ID/Embedded"
626+ , selfClosingTag "GraphicBounds" [("Left","0"), ("Top","0")
627+ , ("Right", showFl $ ow*ow / imgWidth)
628+ , ("Bottom", showFl $ oh*oh / imgHeight)]
629+ ]
625630 , selfClosingTag "Link" [("Self", "ueb"), ("LinkResourceURI", src')]
626631 ]
627632 doc = inTags True "CharacterStyleRange" attrs
test/command/5541-nesting.md+1
@@ -80,6 +80,7 @@
8080 <Profile type="string">
8181 $ID/Embedded
8282 </Profile>
83+ <GraphicBounds Left="0" Top="0" Right="150" Bottom="150" />
8384 </Properties>
8485 <Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
8586 </Image>
test/command/svg.md+4
@@ -23,6 +23,7 @@
2323 <Profile type="string">
2424 $ID/Embedded
2525 </Profile>
26+ <GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
2627 </Properties>
2728 <Link Self="ueb" LinkResourceURI="file:command/corrupt.svg" />
2829 </Image>
@@ -56,6 +57,7 @@
5657 <Profile type="string">
5758 $ID/Embedded
5859 </Profile>
60+ <GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
5961 </Properties>
6062 <Link Self="ueb" LinkResourceURI="file:command/SVG_logo.svg" />
6163 </Image>
@@ -89,6 +91,7 @@
8991 <Profile type="string">
9092 $ID/Embedded
9193 </Profile>
94+ <GraphicBounds Left="0" Top="0" Right="300" Bottom="200" />
9295 </Properties>
9396 <Link Self="ueb" LinkResourceURI="file:command/SVG_logo-without-xml-declaration.svg" />
9497 </Image>
@@ -122,6 +125,7 @@
122125 <Profile type="string">
123126 $ID/Embedded
124127 </Profile>
128+ <GraphicBounds Left="0" Top="0" Right="109.5" Bottom="130.5" />
125129 </Properties>
126130 <Link Self="ueb" LinkResourceURI="file:command/inkscape-cube.svg" />
127131 </Image>
test/writer.icml+2
@@ -2800,6 +2800,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
28002800 <Profile type="string">
28012801 $ID/Embedded
28022802 </Profile>
2803+ <GraphicBounds Left="0" Top="0" Right="150" Bottom="150" />
28032804 </Properties>
28042805 <Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
28052806 </Image>
@@ -2836,6 +2837,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
28362837 <Profile type="string">
28372838 $ID/Embedded
28382839 </Profile>
2840+ <GraphicBounds Left="0" Top="0" Right="20" Bottom="22" />
28392841 </Properties>
28402842 <Link Self="ueb" LinkResourceURI="file:movie.jpg" />
28412843 </Image>