git.iko.soy/typeable/pandoc
on master help sign in
Fix percentage image scaling in ODT (#4881)
12cec8fNils Carlson
src/Text/Pandoc/Writers/ODT.hs+2−2
@@ -189,8 +189,8 @@ transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = catchError
189 let dims =
189 let dims =
190 case (getDim Width, getDim Height) of
190 case (getDim Width, getDim Height) of
191 (Just w, Just h) -> [("width", show w), ("height", show h)]
191 (Just w, Just h) -> [("width", show w), ("height", show h)]
192− (Just w@(Percent p), Nothing) -> [("width", show w), ("height", show (p / ratio) ++ "%")]
192+ (Just w@(Percent _), Nothing) -> [("rel-width", show w),("rel-height", "scale"),("width", show ptX ++ "pt"),("height", show ptY ++ "pt")]
193− (Nothing, Just h@(Percent p)) -> [("width", show (p * ratio) ++ "%"), ("height", show h)]
193+ (Nothing, Just h@(Percent _)) -> [("rel-width", "scale"),("rel-height", show h),("width", show ptX ++ "pt"),("height", show ptY ++ "pt")]
194 (Just w@(Inch i), Nothing) -> [("width", show w), ("height", show (i / ratio) ++ "in")]
194 (Just w@(Inch i), Nothing) -> [("width", show w), ("height", show (i / ratio) ++ "in")]
195 (Nothing, Just h@(Inch i)) -> [("width", show (i * ratio) ++ "in"), ("height", show h)]
195 (Nothing, Just h@(Inch i)) -> [("width", show (i * ratio) ++ "in"), ("height", show h)]
196 _ -> [("width", show ptX ++ "pt"), ("height", show ptY ++ "pt")]
196 _ -> [("width", show ptX ++ "pt"), ("height", show ptY ++ "pt")]
src/Text/Pandoc/Writers/OpenDocument.hs+2
@@ -506,7 +506,9 @@ inlineToOpenDocument o ils
506 modify (\st -> st{ stImageId = id' + 1 })
506 modify (\st -> st{ stImageId = id' + 1 })
507 let getDims [] = []
507 let getDims [] = []
508 getDims (("width", w) :xs) = ("svg:width", w) : getDims xs
508 getDims (("width", w) :xs) = ("svg:width", w) : getDims xs
509+ getDims (("rel-width", w):xs) = ("style:rel-width", w) : getDims xs
509 getDims (("height", h):xs) = ("svg:height", h) : getDims xs
510 getDims (("height", h):xs) = ("svg:height", h) : getDims xs
511+ getDims (("rel-height", w):xs) = ("style:rel-height", w) : getDims xs
510 getDims (_:xs) = getDims xs
512 getDims (_:xs) = getDims xs
511 return $ inTags False "draw:frame"
513 return $ inTags False "draw:frame"
512 (("draw:name", "img" ++ show id') : getDims kvs) $
514 (("draw:name", "img" ++ show id') : getDims kvs) $