diff options
-rw-r--r-- | MANUAL.txt | 6 | ||||
-rw-r--r-- | src/Text/Pandoc/App.hs | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 51b324817..8c65789b9 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -690,6 +690,12 @@ General writer options repeatedly to include multiple files. They will be included in the order specified. Implies `--standalone`. +`--resource-path=`*SEARCHPATH* + +: List of paths to search for images and other resources. + The paths should be separated by `:` on linux, unix, and + MacOS systems, and by `;` on Windows. + Options affecting specific writers ---------------------------------- diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index 9c8e1bde4..a4967e5d1 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -70,7 +70,7 @@ import System.IO.Error (isDoesNotExistError) import Text.Pandoc import Text.Pandoc.Builder (setMeta) import Text.Pandoc.Class (PandocIO, getLog, withMediaBag, - extractMedia, fillMediaBag) + extractMedia, fillMediaBag, setResourcePath) import Text.Pandoc.Highlighting (highlightingStyles) import Text.Pandoc.Lua ( runLuaFilter ) import Text.Pandoc.PDF (makePDF) @@ -414,6 +414,7 @@ convertWithOpts opts = do let eol = fromMaybe nativeNewline $ optEol opts runIO' $ do + setResourcePath $ "." : (optResourcePath opts) (doc, media) <- withMediaBag $ sourceToDoc sources >>= ( (if isJust (optExtractMedia opts) then fillMediaBag (writerSourceURL writerOptions) @@ -569,6 +570,7 @@ data Opt = Opt , optIncludeBeforeBody :: [FilePath] -- ^ Files to include before , optIncludeAfterBody :: [FilePath] -- ^ Files to include after body , optIncludeInHeader :: [FilePath] -- ^ Files to include in header + , optResourcePath :: [FilePath] -- ^ Path to search for images etc , optEol :: Maybe Newline -- ^ Enforce line-endings } @@ -638,6 +640,7 @@ defaultOpts = Opt , optIncludeBeforeBody = [] , optIncludeAfterBody = [] , optIncludeInHeader = [] + , optResourcePath = [] , optEol = Nothing } @@ -1052,6 +1055,14 @@ options = "FILE") "" -- "File to include after document body" + , Option "" ["resource-path"] + (ReqArg + (\arg opt -> return opt { optResourcePath = + splitSearchPath arg }) + "SEARCHPATH") + "" -- "Paths to search for images and other resources" + + , Option "" ["self-contained"] (NoArg (\opt -> return opt { optSelfContained = True, |