git.iko.soy/typeable/pandoc
on master help sign in
Added `--resource-path=SEARCHPATH` command line option.
fd6e65bJohn MacFarlane
MANUAL.txt+6
@@ -690,6 +690,12 @@ General writer options
690 repeatedly to include multiple files. They will be included in the
690 repeatedly to include multiple files. They will be included in the
691 order specified. Implies `--standalone`.
691 order specified. Implies `--standalone`.
692
692
693+`--resource-path=`*SEARCHPATH*
694+
695+: List of paths to search for images and other resources.
696+ The paths should be separated by `:` on linux, unix, and
697+ MacOS systems, and by `;` on Windows.
698+
693Options affecting specific writers
699Options affecting specific writers
694----------------------------------
700----------------------------------
695
701
src/Text/Pandoc/App.hs+12−1
@@ -70,7 +70,7 @@ import System.IO.Error (isDoesNotExistError)
70import Text.Pandoc
70import Text.Pandoc
71import Text.Pandoc.Builder (setMeta)
71import Text.Pandoc.Builder (setMeta)
72import Text.Pandoc.Class (PandocIO, getLog, withMediaBag,
72import Text.Pandoc.Class (PandocIO, getLog, withMediaBag,
73− extractMedia, fillMediaBag)
73+ extractMedia, fillMediaBag, setResourcePath)
74import Text.Pandoc.Highlighting (highlightingStyles)
74import Text.Pandoc.Highlighting (highlightingStyles)
75import Text.Pandoc.Lua ( runLuaFilter )
75import Text.Pandoc.Lua ( runLuaFilter )
76import Text.Pandoc.PDF (makePDF)
76import Text.Pandoc.PDF (makePDF)
@@ -414,6 +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 (doc, media) <- withMediaBag $ sourceToDoc sources >>=
418 (doc, media) <- withMediaBag $ sourceToDoc sources >>=
418 ( (if isJust (optExtractMedia opts)
419 ( (if isJust (optExtractMedia opts)
419 then fillMediaBag (writerSourceURL writerOptions)
420 then fillMediaBag (writerSourceURL writerOptions)
@@ -569,6 +570,7 @@ data Opt = Opt
569 , optIncludeBeforeBody :: [FilePath] -- ^ Files to include before
570 , optIncludeBeforeBody :: [FilePath] -- ^ Files to include before
570 , optIncludeAfterBody :: [FilePath] -- ^ Files to include after body
571 , optIncludeAfterBody :: [FilePath] -- ^ Files to include after body
571 , optIncludeInHeader :: [FilePath] -- ^ Files to include in header
572 , optIncludeInHeader :: [FilePath] -- ^ Files to include in header
573+ , optResourcePath :: [FilePath] -- ^ Path to search for images etc
572 , optEol :: Maybe Newline -- ^ Enforce line-endings
574 , optEol :: Maybe Newline -- ^ Enforce line-endings
573 }
575 }
574
576
@@ -638,6 +640,7 @@ defaultOpts = Opt
638 , optIncludeBeforeBody = []
640 , optIncludeBeforeBody = []
639 , optIncludeAfterBody = []
641 , optIncludeAfterBody = []
640 , optIncludeInHeader = []
642 , optIncludeInHeader = []
643+ , optResourcePath = []
641 , optEol = Nothing
644 , optEol = Nothing
642 }
645 }
643
646
@@ -1052,6 +1055,14 @@ options =
1052 "FILE")
1055 "FILE")
1053 "" -- "File to include after document body"
1056 "" -- "File to include after document body"
1054
1057
1058+ , Option "" ["resource-path"]
1059+ (ReqArg
1060+ (\arg opt -> return opt { optResourcePath =
1061+ splitSearchPath arg })
1062+ "SEARCHPATH")
1063+ "" -- "Paths to search for images and other resources"
1064+
1065+
1055 , Option "" ["self-contained"]
1066 , Option "" ["self-contained"]
1056 (NoArg
1067 (NoArg
1057 (\opt -> return opt { optSelfContained = True,
1068 (\opt -> return opt { optSelfContained = True,