Get rid of wrapper PageContents structure returned by PageContent in the PDF.Text module (and return directly [ByteString] instead)
This commit is contained in:
parent
42a02808c1
commit
08a9717b3a
1 changed files with 3 additions and 8 deletions
|
@ -1,8 +1,7 @@
|
|||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module PDF.Text (
|
||||
PageContents(..)
|
||||
, pageContents
|
||||
pageContents
|
||||
) where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
|
@ -76,15 +75,11 @@ nameArg = Typed . NameObject <$> name <* blank
|
|||
stringArg :: MonadParser m => m Argument
|
||||
stringArg = Typed . StringObject <$> stringObject <* blank
|
||||
|
||||
data PageContents = PageContents {
|
||||
chunks :: [ByteString]
|
||||
}
|
||||
|
||||
type ParserWithFont = ReaderT CMappers (Parser CMap)
|
||||
|
||||
pageContents :: CMappers -> ByteString -> Either String PageContents
|
||||
pageContents :: CMappers -> ByteString -> Either String [ByteString]
|
||||
pageContents font input =
|
||||
evalParser (runReaderT (PageContents <$> page) font) emptyCMap input
|
||||
evalParser (runReaderT page font) emptyCMap input
|
||||
|
||||
page :: ParserWithFont [ByteString]
|
||||
page = graphicState <|> text <?> "Text page contents"
|
||||
|
|
Loading…
Reference in a new issue