git.iko.soy/typeable/pandoc
on master help sign in
Improve pdfSize in ImageSize by ignoring all whitespace in /MediaBox command (#5383)
567a43aricharddavis
src/Text/Pandoc/ImageSize.hs+4−1
@@ -278,13 +278,16 @@ pPdfSize = do
278 A.skipWhile (/='/')
278 A.skipWhile (/='/')
279 A.char8 '/'
279 A.char8 '/'
280 (do A.string "MediaBox"
280 (do A.string "MediaBox"
281+ A.skipSpace
281 A.char8 '['
282 A.char8 '['
283+ A.skipSpace
282 [x1,y1,x2,y2] <- A.count 4 $ do
284 [x1,y1,x2,y2] <- A.count 4 $ do
283− A.skipWhile (==' ')
285+ A.skipSpace
284 raw <- A.many1 $ A.satisfy (\c -> isDigit c || c == '.')
286 raw <- A.many1 $ A.satisfy (\c -> isDigit c || c == '.')
285 case safeRead raw of
287 case safeRead raw of
286 Just (r :: Double) -> return $ floor r
288 Just (r :: Double) -> return $ floor r
287 Nothing -> mzero
289 Nothing -> mzero
290+ A.skipSpace
288 A.char8 ']'
291 A.char8 ']'
289 return $ ImageSize{
292 return $ ImageSize{
290 pxX = x2 - x1
293 pxX = x2 - x1