pdf-toolbox-core 0.0.3.0 → 0.0.3.1
raw patch · 3 files changed
+27/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- changelog.md +3/−0
- lib/Pdf/Toolbox/Core/Parsers/Object.hs +22/−3
- pdf-toolbox-core.cabal +2/−2
changelog.md view
@@ -1,3 +1,6 @@+unreleased++* support 1- and 2-digit escapes sequence in literal string 0.0.3.0
lib/Pdf/Toolbox/Core/Parsers/Object.hs view
@@ -23,6 +23,7 @@ ) where +import Data.List import Data.Char import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BS8@@ -34,6 +35,7 @@ #endif import Control.Applicative+import Control.Monad import Pdf.Toolbox.Core.Object.Types import Pdf.Toolbox.Core.Parsers.Util@@ -123,11 +125,28 @@ 't' -> takeStr lvl ('\t' : res) '\r' -> takeStr lvl res _ -> do- ch1 <- P.anyChar- ch2 <- P.anyChar- takeStr lvl (toEnum (charToInt ch' * 64 + charToInt ch1 * 8 + charToInt ch2) : res)+ ds <- take3Digits [ch']+ let i = toEnum+ . foldl'+ (\acc (a, b) -> acc + a * charToInt b)+ 0+ . zip [1, 8, 64]+ $ ds+ takeStr lvl (i : res) _ -> takeStr lvl (ch : res) charToInt ch = fromEnum ch - 48+ take3Digits ds+ | length ds >= 3+ = return ds+ | otherwise+ = do+ d <- P.peekChar'+ if isDigit d+ then do+ void P.anyChar+ take3Digits (d : ds)+ else+ return (ds ++ repeat '0') -- | -- >>> parseOnly parseHexStr "<68656C6C6F>"
pdf-toolbox-core.cabal view
@@ -1,11 +1,11 @@ name: pdf-toolbox-core-version: 0.0.3.0+version: 0.0.3.1 synopsis: A collection of tools for processing PDF files. license: BSD3 license-file: LICENSE author: Yuras Shumovich maintainer: Yuras Shumovich <shumovichy@gmail.com>-copyright: Copyright (c) Yuras Shumovich 2012-2014+copyright: Copyright (c) Yuras Shumovich 2012-2015 category: PDF build-type: Simple cabal-version: >=1.8