aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-07-26 09:49:37 -0600
committerJohn MacFarlane <[email protected]>2023-07-26 09:49:37 -0600
commitecb59e1cdef1e32d0dfc71412ef72a3affc016f4 (patch)
treebb58b277148e60ab98a6a8c2c961c240954c0053 /src
parentd7c43fda32b3cedc362196d0fc4d09aa4770841a (diff)
SelfContained: fix calculation of svg width and height.
We were computing width and height from viewBox incorrectly. See #8969.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/SelfContained.hs6
1 files changed, 3 insertions, 3 deletions
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