{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
module Text.Pandoc.Filter.Plot.Renderers.Mathematica (
mathematicaSupportedSaveFormats
, mathematicaCommand
, mathematicaCapture
, mathematicaAvailable
) where
import Text.Pandoc.Filter.Plot.Renderers.Prelude
mathematicaSupportedSaveFormats :: [SaveFormat]
mathematicaSupportedSaveFormats :: [SaveFormat]
mathematicaSupportedSaveFormats = [SaveFormat
PNG, SaveFormat
PDF, SaveFormat
SVG, SaveFormat
JPG, SaveFormat
EPS, SaveFormat
GIF, SaveFormat
TIF]
mathematicaCommand :: OutputSpec -> PlotM Text
mathematicaCommand :: OutputSpec -> PlotM Text
mathematicaCommand OutputSpec{..} = do
FilePath
exe <- Toolkit -> PlotM FilePath
executable Toolkit
Mathematica
Text -> PlotM Text
forall (m :: * -> *) a. Monad m => a -> m a
return [st|#{exe} -script "#{oScriptPath}"|]
mathematicaAvailable :: PlotM Bool
mathematicaAvailable :: PlotM Bool
mathematicaAvailable = do
FilePath
exe <- Toolkit -> PlotM FilePath
executable Toolkit
Mathematica
Text -> PlotM Bool
commandSuccess [st|#{exe} -h|]
mathematicaCapture :: FigureSpec -> FilePath -> Script
mathematicaCapture :: FigureSpec -> FilePath -> Text
mathematicaCapture FigureSpec{..} fname :: FilePath
fname = [st|
Export["#{fname}", %, #{show saveFormat}]
|]