diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-30 16:43:17 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-30 16:43:17 +0200 |
commit | 6ad486c3c3922e4ac7dd5710f69c3ccf623e92b4 (patch) | |
tree | 0c9b584c5adf2a4ecf6ab862b3c736b2c1a7186a /src | |
parent | 2f19b5daac4da2b849b5165f9eb1386ab41ccc1b (diff) | |
download | pandoc-6ad486c3c3922e4ac7dd5710f69c3ccf623e92b4.tar.gz |
Automatically include URI-encoded jats.csl for jats output.
This way people can do
pandoc -s -t jats --filter pandoc-citeproc
and it will just work. If they want to specify a stylesheet,
they still can.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/App.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 0fc883792..e45d10254 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -73,7 +73,7 @@ import Text.Pandoc.Lua ( runLuaFilter ) import Text.Pandoc.MediaBag (MediaBag, extractMediaBag, mediaDirectory) import Text.Pandoc.PDF (makePDF) import Text.Pandoc.Process (pipeProcess) -import Text.Pandoc.SelfContained (makeSelfContained) +import Text.Pandoc.SelfContained (makeSelfContained, makeDataURI) import Text.Pandoc.Shared (err, headerShift, openURL, readDataFile, readDataFileUTF8, safeRead, tabFilter) import qualified Text.Pandoc.UTF8 as UTF8 @@ -386,10 +386,16 @@ 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 + runIO' $ do (doc, media) <- sourceToDoc sources doc' <- (maybe return (extractMedia media) (optExtractMedia opts) >=> - return . flip (foldr addMetadata) (optMetadata opts) >=> + return . flip (foldr addMetadata) metadata >=> applyTransforms transforms >=> applyLuaFilters datadir (optLuaFilters opts) [format] >=> applyFilters datadir filters' [format]) doc |