git.iko.soy/typeable/pandoc
on master help sign in
Finished implemtation of `--resource-path`.

* Default is just working directory. * Working directory must be explicitly specifide if `--resource-path` option is used.

commit8c1b81bbef7125a9a2fde9d6894578f06bf4cedd authorJohn MacFarlane <jgm@berkeley.edu> dateSun 21 May 2017, 08:59 (9 years ago) parent6a7f980
3 files changed+11−5
MANUAL.txt+7−1 src/Text/Pandoc/App.hs+2−2 src/Text/Pandoc/Readers/LaTeX.hs+2−2
MANUAL.txt+7−1
@@ -694,7 +694,13 @@ General writer options
694694
695695: List of paths to search for images and other resources.
696696 The paths should be separated by `:` on linux, unix, and
697− MacOS systems, and by `;` on Windows.
697+ MacOS systems, and by `;` on Windows. If `--resource-path`
698+ is not specified, the default resource path is the working
699+ directory. Note that, if `--resource-path` is specified,
700+ the working directory must be explicitly listed or it
701+ will not be searched. For example:
702+ `--resource-path=.:test` will search the working directory
703+ and the `test` subdirectory, in that order.
698704
699705Options affecting specific writers
700706----------------------------------
src/Text/Pandoc/App.hs+2−2
@@ -414,7 +414,7 @@ convertWithOpts opts = do
414414 let eol = fromMaybe nativeNewline $ optEol opts
415415
416416 runIO' $ do
417− setResourcePath $ "." : (optResourcePath opts)
417+ setResourcePath (optResourcePath opts)
418418 (doc, media) <- withMediaBag $ sourceToDoc sources >>=
419419 ( (if isJust (optExtractMedia opts)
420420 then fillMediaBag (writerSourceURL writerOptions)
@@ -640,7 +640,7 @@ defaultOpts = Opt
640640 , optIncludeBeforeBody = []
641641 , optIncludeAfterBody = []
642642 , optIncludeInHeader = []
643− , optResourcePath = []
643+ , optResourcePath = ["."]
644644 , optEol = Nothing
645645 }
646646
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -46,7 +46,7 @@ import Safe (minimumDef)
4646import System.FilePath (addExtension, replaceExtension, takeExtension)
4747import Text.Pandoc.Builder
4848import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv, readFileFromDirs,
49− report, setResourcePath)
49+ report, setResourcePath, getResourcePath)
5050import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension)
5151import Text.Pandoc.ImageSize (numUnit, showFl)
5252import Text.Pandoc.Logging
@@ -417,7 +417,7 @@ blockCommands = M.fromList $
417417graphicsPath :: PandocMonad m => LP m Blocks
418418graphicsPath = do
419419 ps <- bgroup *> (manyTill braced egroup)
420− setResourcePath (".":ps)
420+ getResourcePath >>= setResourcePath . (++ ps)
421421 return mempty
422422
423423addMeta :: PandocMonad m => ToMetaValue a => String -> a -> LP m ()