pdfinfo 0.1 → 0.1.1
raw patch · 2 files changed
+7/−4 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.PDF.Info: data ParsePDFInfo a
+ Text.PDF.Info: runParse :: ParsePDFInfo a -> Either PDFInfoError a
Files
- pdfinfo.cabal +1/−1
- src/Text/PDF/Info.hs +6/−3
pdfinfo.cabal view
@@ -1,5 +1,5 @@ Name: pdfinfo-Version: 0.1+Version: 0.1.1 Synopsis: Wrapper around the pdfinfo command. Description: Just a wrapper around the pdfinfo command. See man pdfinfo. License: BSD3
src/Text/PDF/Info.hs view
@@ -8,6 +8,8 @@ ,PDFSize(..) ,PDFInfoError(..) -- * Internals+ ,ParsePDFInfo+ ,runParse ,parse ,parseSize ,parseDate@@ -102,14 +104,15 @@ -- | Parse a page size. This is loosely defined. parseSize :: String -> ParsePDFInfo PDFSize parseSize s = - case second (drop 1) . span (/='x') . filter (`elem`".x"++['1'..'9']) $ s of- (readRight -> Right x,readRight -> Right y) -> return $ PDFSize x y+ case words s of+ ((readRight -> Right x):"x":(readRight -> Right y):_) -> + return $ PDFSize x y _ -> throwError $ ParseError $ "Unable to read size: " ++ show s -- | Parse a date according to pdfinfo's format. parseDate :: String -> ParsePDFInfo UTCTime parseDate s = - case parseTime defaultTimeLocale "%a %b %d %H:%M:%S %Y" s of+ case parseTime defaultTimeLocale "%a %b %e %H:%M:%S %Y" s of Just ok -> return ok Nothing -> throwError $ ParseError $ "Unable to parse date: " ++ show s