@@ -26,6 +26,7 @@ module Text.Pandoc.Filter.Plot.Monad.Types
2626 inclusionKeys ,
2727 Executable (.. ),
2828 exeFromPath ,
29+ pathToExe ,
2930 -- Utilities
3031 isWindows ,
3132 )
@@ -37,7 +38,7 @@ import Data.String (IsString (..))
3738import Data.Text (Text , pack , unpack )
3839import Data.Yaml (FromJSON (.. ), ToJSON (toJSON ), withText )
3940import GHC.Generics (Generic )
40- import System.FilePath (splitFileName )
41+ import System.FilePath (splitFileName , (</>) )
4142import System.Info (os )
4243import Text.Pandoc.Definition (Attr )
4344
@@ -102,6 +103,9 @@ exeFromPath fp =
102103 let (dir, name) = splitFileName fp
103104 in Executable dir (pack name)
104105
106+ pathToExe :: Executable -> FilePath
107+ pathToExe (Executable dir name) = dir </> unpack name
108+
105109-- | Source context for plotting scripts
106110type Script = Text
107111
@@ -170,6 +174,8 @@ inclusionKeys = enumFromTo (minBound :: InclusionKey) maxBound
170174data FigureSpec = FigureSpec
171175 { -- | Renderer to use for this figure.
172176 renderer_ :: ! Renderer ,
177+ -- | Executable to use in rendering this figure.
178+ fsExecutable :: Executable ,
173179 -- | Figure caption.
174180 caption :: ! Text ,
175181 -- | Append link to source code in caption.
@@ -263,13 +269,14 @@ data OutputSpec = OutputSpec
263269 oScriptPath :: FilePath ,
264270 -- | Figure output path
265271 oFigurePath :: FilePath ,
272+ -- | Executable to use during rendering
273+ oExecutable :: Executable ,
266274 -- | Current working directory
267275 oCWD :: FilePath
268276 }
269277
270278data Renderer = Renderer
271279 { rendererToolkit :: Toolkit ,
272- rendererExe :: Executable ,
273280 rendererCapture :: FigureSpec -> FilePath -> Script ,
274281 rendererCommand :: OutputSpec -> Text ,
275282 rendererSupportedSaveFormats :: [SaveFormat ],
0 commit comments