{-# 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 = [PNG, PDF, SVG, JPG, EPS, GIF, TIF]
mathematicaCommand :: OutputSpec -> IO Text
mathematicaCommand OutputSpec{..} = do
exe <- executable Mathematica oConfiguration
return [st|#{exe} -script "#{oScriptPath}"|]
mathematicaAvailable :: Configuration -> IO Bool
mathematicaAvailable conf = do
exe <- executable Mathematica conf
commandSuccess [st|#{exe} -h|]
mathematicaCapture :: FigureSpec -> FilePath -> Script
mathematicaCapture FigureSpec{..} fname = [st|
Export["#{fname}", %, #{show saveFormat}]
|]