Actually, the spec calls 'catalog' what we call 'origin' — use 'catalog' for more clarity in regard to the spec

This commit is contained in:
Tissevert 2020-03-18 15:11:28 +01:00
parent 6d265633e4
commit 729e312f90
2 changed files with 6 additions and 6 deletions

View file

@ -13,7 +13,7 @@ import PDF.Box (Box(..))
import PDF.Layer (Layer(..), unify)
import PDF.Object (Object(..))
import PDF.Object.Navigation (
Clear(..), Raw(..), (//), objectById, origin
Clear(..), Raw(..), (//), objectById, catalog
)
import PDF.Output (Output)
import qualified PDF.Output as Output (render)
@ -38,12 +38,12 @@ display getter (Document {eolStyle, layers}) =
Output.render eolStyle <$> runError (runReaderT getter (unify layers))
parse :: [String] -> IO (FilePath, Document -> Either String ByteString)
parse [inputFile] = return (inputFile, display origin)
parse [inputFile] = return (inputFile, display catalog)
parse [inputFile, key] =
return (inputFile, clear . maybe (byPath key) byId $ readMaybe key)
where
byId = objectById . Id
byPath path = origin // (explode path)
byPath path = catalog // (explode path)
explode "" = []
explode path =
case break (== '.') path of

View file

@ -15,7 +15,7 @@ module PDF.Object.Navigation (
, getDictionary
, getKey
, objectById
, origin
, catalog
) where
import Codec.Compression.Zlib (compress, decompress)
@ -77,8 +77,8 @@ castObject directObject = return $ Direct directObject
(>//) :: PDFContent m => Object -> [Component] -> m Object
(>//) object = (return object //)
origin :: PDFContent m => m Object
origin = Direct . Dictionary . trailer . docStructure <$> ask
catalog :: PDFContent m => m Object
catalog = Direct . Dictionary . trailer . docStructure <$> ask
data Clear = Clear
data Raw = Raw