diff options
author | richarddavis <richard.lee.davis@gmail.com> | 2019-03-21 09:43:56 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-21 10:43:56 -0600 |
commit | 567a43ace322bb8198a75954fef97e1cc91015a1 (patch) | |
tree | 32b97221dbe3c7c749fd0774d1c8653b9478d84e /src | |
parent | 66e5f0ff8de0f968d475f5135e0d9362690f2a0a (diff) | |
download | pandoc-567a43ace322bb8198a75954fef97e1cc91015a1.tar.gz |
Improve pdfSize in ImageSize by ignoring all whitespace in /MediaBox command (#5383)
This fix ignores all whitespace in the PDF /MediaBox line so that a wider range of PDF sizes can be read. This improves fix to #4322.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/ImageSize.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/ImageSize.hs b/src/Text/Pandoc/ImageSize.hs index c5289bbc2..afbba9b8b 100644 --- a/src/Text/Pandoc/ImageSize.hs +++ b/src/Text/Pandoc/ImageSize.hs @@ -278,13 +278,16 @@ pPdfSize = do A.skipWhile (/='/') A.char8 '/' (do A.string "MediaBox" + A.skipSpace A.char8 '[' + A.skipSpace [x1,y1,x2,y2] <- A.count 4 $ do - A.skipWhile (==' ') + A.skipSpace raw <- A.many1 $ A.satisfy (\c -> isDigit c || c == '.') case safeRead raw of Just (r :: Double) -> return $ floor r Nothing -> mzero + A.skipSpace A.char8 ']' return $ ImageSize{ pxX = x2 - x1 |