Actually, the spec calls 'catalog' what we call 'origin' — use 'catalog' for more clarity in regard to the spec
This commit is contained in:
parent
6d265633e4
commit
729e312f90
2 changed files with 6 additions and 6 deletions
|
@ -13,7 +13,7 @@ import PDF.Box (Box(..))
|
||||||
import PDF.Layer (Layer(..), unify)
|
import PDF.Layer (Layer(..), unify)
|
||||||
import PDF.Object (Object(..))
|
import PDF.Object (Object(..))
|
||||||
import PDF.Object.Navigation (
|
import PDF.Object.Navigation (
|
||||||
Clear(..), Raw(..), (//), objectById, origin
|
Clear(..), Raw(..), (//), objectById, catalog
|
||||||
)
|
)
|
||||||
import PDF.Output (Output)
|
import PDF.Output (Output)
|
||||||
import qualified PDF.Output as Output (render)
|
import qualified PDF.Output as Output (render)
|
||||||
|
@ -38,12 +38,12 @@ display getter (Document {eolStyle, layers}) =
|
||||||
Output.render eolStyle <$> runError (runReaderT getter (unify layers))
|
Output.render eolStyle <$> runError (runReaderT getter (unify layers))
|
||||||
|
|
||||||
parse :: [String] -> IO (FilePath, Document -> Either String ByteString)
|
parse :: [String] -> IO (FilePath, Document -> Either String ByteString)
|
||||||
parse [inputFile] = return (inputFile, display origin)
|
parse [inputFile] = return (inputFile, display catalog)
|
||||||
parse [inputFile, key] =
|
parse [inputFile, key] =
|
||||||
return (inputFile, clear . maybe (byPath key) byId $ readMaybe key)
|
return (inputFile, clear . maybe (byPath key) byId $ readMaybe key)
|
||||||
where
|
where
|
||||||
byId = objectById . Id
|
byId = objectById . Id
|
||||||
byPath path = origin // (explode path)
|
byPath path = catalog // (explode path)
|
||||||
explode "" = []
|
explode "" = []
|
||||||
explode path =
|
explode path =
|
||||||
case break (== '.') path of
|
case break (== '.') path of
|
||||||
|
|
|
@ -15,7 +15,7 @@ module PDF.Object.Navigation (
|
||||||
, getDictionary
|
, getDictionary
|
||||||
, getKey
|
, getKey
|
||||||
, objectById
|
, objectById
|
||||||
, origin
|
, catalog
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Codec.Compression.Zlib (compress, decompress)
|
import Codec.Compression.Zlib (compress, decompress)
|
||||||
|
@ -77,8 +77,8 @@ castObject directObject = return $ Direct directObject
|
||||||
(>//) :: PDFContent m => Object -> [Component] -> m Object
|
(>//) :: PDFContent m => Object -> [Component] -> m Object
|
||||||
(>//) object = (return object //)
|
(>//) object = (return object //)
|
||||||
|
|
||||||
origin :: PDFContent m => m Object
|
catalog :: PDFContent m => m Object
|
||||||
origin = Direct . Dictionary . trailer . docStructure <$> ask
|
catalog = Direct . Dictionary . trailer . docStructure <$> ask
|
||||||
|
|
||||||
data Clear = Clear
|
data Clear = Clear
|
||||||
data Raw = Raw
|
data Raw = Raw
|
||||||
|
|
Loading…
Reference in a new issue