packages feed

hpdft 0.1.1.2 → 0.1.1.3

raw patch · 3 files changed

+11/−7 lines, 3 filesdep +regex-tdfadep −regex-compat

Dependencies added: regex-tdfa

Dependencies removed: regex-compat

Files

hpdft.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.0 name:                hpdft-version:             0.1.1.2+version:             0.1.1.3 synopsis:            A tool for looking through PDF file using Haskell description:     @@ -68,7 +68,7 @@                      , memory >= 0.18.0 && < 0.19                      , optparse-applicative >= 0.18.1 && < 0.19                      , regex-base >= 0.94.0 && < 0.95-                     , regex-compat >= 0.95.2 && < 0.96+                     , regex-tdfa >= 1.3.2 && < 1.4                      , semigroups >= 0.20 && < 0.21                      , text >= 2.0.2 && < 2.1                      , utf8-string >= 1.0.2 && < 1.1
hpdft.hs view
@@ -24,7 +24,9 @@ import Options.Applicative import Data.Semigroup ((<>)) -import Text.Regex (mkRegex, matchRegexAll)+import Text.Regex.Base.RegexLike ( makeRegex )+import Text.Regex.TDFA.String    ( regexec )+ import Options.Applicative (strOption) import Control.Monad (when) import PDF.Definition (Obj(PdfStream))@@ -288,8 +290,10 @@      grepByLine :: String -> PDFStream -> String     grepByLine re txt =-      case matchRegexAll (mkRegex re) $ TL.unpack $ TL.decodeUtf8 txt of-        Just (b, m, a, _) -> (b <> (highlight m) <> a)-        Nothing -> ""+      case regexec (makeRegex re) $ TL.unpack $ TL.decodeUtf8 txt of+        Left _  -> ""+        Right m -> case m of+         Just (b, m, a, _) -> (b <> (highlight m) <> a)+         Nothing           -> ""      highlight m = "\ESC[31m" <> m <> "\ESC[0m"
src/PDF/CFF.hs view
@@ -68,7 +68,7 @@ parseEncoding c d = case parseOnly (many1 dict) d of   -- '16' is key for 'Encoding' in Top DICT   Right dictData -> case lookup [16] dictData of -    Just (DictInt 0:[]) -> []  +    Just (DictInt 0:[]) -> [] -- Standard Encoding (not supported)     Just (DictInt 1:[]) -> [] -- Expert Encoding (not supported)     Just (DictInt n:[]) -> -- n is offset       case parseOnly encodingArray $ BS.drop n c of