diff options
| author | John MacFarlane <[email protected]> | 2023-07-26 09:58:22 -0600 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2023-07-26 09:58:22 -0600 |
| commit | 95140b428bfba339e8806255657a97ec32a33a17 (patch) | |
| tree | e57eb5b083fb90c29f30b74450d0465b3853625b /src/Text | |
| parent | ecb59e1cdef1e32d0dfc71412ef72a3affc016f4 (diff) | |
SelfContained: don't coerce calculated width/height to Int.
Fractional values are okay. See #8969.
Diffstat (limited to 'src/Text')
| -rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 9e07f8850..db2c67bef 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -215,12 +215,15 @@ combineSvgAttrs svgAttrs imgAttrs = combinedAttrs ++ [("viewBox", T.unwords ["0", "0", tshow w, tshow h])] (Just (_minx,_miny,width,height), Nothing, Nothing) -> combinedAttrs ++ - [ ("width", tshow (floor width :: Int)) | + [ ("width", dropPointZero (tshow width)) | isNothing (lookup "width" combinedAttrs) ] ++ - [ ("height", tshow (floor height :: Int)) | + [ ("height", dropPointZero (tshow height)) | isNothing (lookup "height" combinedAttrs) ] _ -> combinedAttrs where + dropPointZero t = case T.stripSuffix ".0" t of + Nothing -> t + Just t' -> t' combinedAttrs = imgAttrs ++ [(k,v') | (k,v) <- svgAttrs , v' <- fixAttr k v |
