From ecb59e1cdef1e32d0dfc71412ef72a3affc016f4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 26 Jul 2023 09:49:37 -0600 Subject: SelfContained: fix calculation of svg width and height. We were computing width and height from viewBox incorrectly. See #8969. --- src/Text/Pandoc/SelfContained.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 428a18f0f..9e07f8850 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -213,11 +213,11 @@ combineSvgAttrs svgAttrs imgAttrs = case (mbViewBox, mbHeight, mbWidth) of (Nothing, Just h, Just w) -> -- calculate viewBox combinedAttrs ++ [("viewBox", T.unwords ["0", "0", tshow w, tshow h])] - (Just (llx,lly,urx,ury), Nothing, Nothing) -> -- calculate width, height + (Just (_minx,_miny,width,height), Nothing, Nothing) -> combinedAttrs ++ - [ ("width", tshow (floor urx - floor llx :: Int)) | + [ ("width", tshow (floor width :: Int)) | isNothing (lookup "width" combinedAttrs) ] ++ - [ ("height", tshow (floor ury - floor lly :: Int)) | + [ ("height", tshow (floor height :: Int)) | isNothing (lookup "height" combinedAttrs) ] _ -> combinedAttrs where -- cgit v1.2.3