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,8 +1,7 @@
|
||||||
{-# LANGUAGE NamedFieldPuns #-}
|
{-# LANGUAGE NamedFieldPuns #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module PDF.Text (
|
module PDF.Text (
|
||||||
PageContents(..)
|
pageContents
|
||||||
, pageContents
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative ((<|>))
|
import Control.Applicative ((<|>))
|
||||||
|
@ -76,15 +75,11 @@ nameArg = Typed . NameObject <$> name <* blank
|
||||||
stringArg :: MonadParser m => m Argument
|
stringArg :: MonadParser m => m Argument
|
||||||
stringArg = Typed . StringObject <$> stringObject <* blank
|
stringArg = Typed . StringObject <$> stringObject <* blank
|
||||||
|
|
||||||
data PageContents = PageContents {
|
|
||||||
chunks :: [ByteString]
|
|
||||||
}
|
|
||||||
|
|
||||||
type ParserWithFont = ReaderT CMappers (Parser CMap)
|
type ParserWithFont = ReaderT CMappers (Parser CMap)
|
||||||
|
|
||||||
pageContents :: CMappers -> ByteString -> Either String PageContents
|
pageContents :: CMappers -> ByteString -> Either String [ByteString]
|
||||||
pageContents font input =
|
pageContents font input =
|
||||||
evalParser (runReaderT (PageContents <$> page) font) emptyCMap input
|
evalParser (runReaderT page font) emptyCMap input
|
||||||
|
|
||||||
page :: ParserWithFont [ByteString]
|
page :: ParserWithFont [ByteString]
|
||||||
page = graphicState <|> text <?> "Text page contents"
|
page = graphicState <|> text <?> "Text page contents"
|
||||||
|
|
Loading…
Reference in New Issue