Don't read jats.csl unless we actually need it.

This commit is contained in:
John MacFarlane 2017-03-30 17:23:16 +02:00
parent 6ad486c3c3
commit 8d50f37d53

View file

@ -386,11 +386,12 @@ convertWithOpts opts = do
withMediaBag . r readerOpts) sources
return (mconcat (map fst pairs), mconcat (map snd pairs))
jatsCSL <- readDataFile datadir "jats.csl"
let jatsEncoded = makeDataURI ("application/xml", jatsCSL)
let metadata = if format == "jats"
then ("csl", jatsEncoded) : optMetadata opts
else optMetadata opts
metadata <- if format == "jats"
then do
jatsCSL <- readDataFile datadir "jats.csl"
let jatsEncoded = makeDataURI ("application/xml", jatsCSL)
return $ ("csl", jatsEncoded) : optMetadata opts
else return $ optMetadata opts
runIO' $ do
(doc, media) <- sourceToDoc sources