@@ -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
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
@@ -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
@@ -1052,6 +1055,14 @@ options =
1053 "" -- "File to include after document body"
1056 "" -- "File to include after document body"
1058+ , Option "" ["resource-path"]
1060+ (\arg opt -> return opt { optResourcePath =
1061+ splitSearchPath arg })
1063+ "" -- "Paths to search for images and other resources"
1055 , Option "" ["self-contained"]
1066 , Option "" ["self-contained"]
1057 (\opt -> return opt { optSelfContained = True,
1068 (\opt -> return opt { optSelfContained = True,