git.iko.soy/typeable/pandoc
on master help sign in
Finished implemtation of `--resource-path`.
8c1b81bJohn MacFarlane
MANUAL.txt+7−1
@@ -694,7 +694,13 @@ General writer options
694
694
695: List of paths to search for images and other resources.
695: List of paths to search for images and other resources.
696 The paths should be separated by `:` on linux, unix, and
696 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.
698
704
699Options affecting specific writers
705Options affecting specific writers
700----------------------------------
706----------------------------------
src/Text/Pandoc/App.hs+2−2
@@ -414,7 +414,7 @@ convertWithOpts opts = do
414 let eol = fromMaybe nativeNewline $ optEol opts
414 let eol = fromMaybe nativeNewline $ optEol opts
415
415
416 runIO' $ do
416 runIO' $ do
417− setResourcePath $ "." : (optResourcePath opts)
417+ setResourcePath (optResourcePath opts)
418 (doc, media) <- withMediaBag $ sourceToDoc sources >>=
418 (doc, media) <- withMediaBag $ sourceToDoc sources >>=
419 ( (if isJust (optExtractMedia opts)
419 ( (if isJust (optExtractMedia opts)
420 then fillMediaBag (writerSourceURL writerOptions)
420 then fillMediaBag (writerSourceURL writerOptions)
@@ -640,7 +640,7 @@ defaultOpts = Opt
640 , optIncludeBeforeBody = []
640 , optIncludeBeforeBody = []
641 , optIncludeAfterBody = []
641 , optIncludeAfterBody = []
642 , optIncludeInHeader = []
642 , optIncludeInHeader = []
643− , optResourcePath = []
643+ , optResourcePath = ["."]
644 , optEol = Nothing
644 , optEol = Nothing
645 }
645 }
646
646
src/Text/Pandoc/Readers/LaTeX.hs+2−2
@@ -46,7 +46,7 @@ import Safe (minimumDef)
46import System.FilePath (addExtension, replaceExtension, takeExtension)
46import System.FilePath (addExtension, replaceExtension, takeExtension)
47import Text.Pandoc.Builder
47import Text.Pandoc.Builder
48import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv, readFileFromDirs,
48import Text.Pandoc.Class (PandocMonad, PandocPure, lookupEnv, readFileFromDirs,
49− report, setResourcePath)
49+ report, setResourcePath, getResourcePath)
50import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension)
50import Text.Pandoc.Highlighting (fromListingsLanguage, languagesByExtension)
51import Text.Pandoc.ImageSize (numUnit, showFl)
51import Text.Pandoc.ImageSize (numUnit, showFl)
52import Text.Pandoc.Logging
52import Text.Pandoc.Logging
@@ -417,7 +417,7 @@ blockCommands = M.fromList $
417graphicsPath :: PandocMonad m => LP m Blocks
417graphicsPath :: PandocMonad m => LP m Blocks
418graphicsPath = do
418graphicsPath = do
419 ps <- bgroup *> (manyTill braced egroup)
419 ps <- bgroup *> (manyTill braced egroup)
420− setResourcePath (".":ps)
420+ getResourcePath >>= setResourcePath . (++ ps)
421 return mempty
421 return mempty
422
422
423addMeta :: PandocMonad m => ToMetaValue a => String -> a -> LP m ()
423addMeta :: PandocMonad m => ToMetaValue a => String -> a -> LP m ()