{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
module Text.Pandoc.Filter.Plot.Renderers.Octave (
octaveSupportedSaveFormats
, octaveCommand
, octaveCapture
, octaveAvailable
) where
import Text.Pandoc.Filter.Plot.Renderers.Prelude
octaveSupportedSaveFormats :: [SaveFormat]
octaveSupportedSaveFormats :: [SaveFormat]
octaveSupportedSaveFormats = [SaveFormat
PNG, SaveFormat
PDF, SaveFormat
SVG, SaveFormat
JPG, SaveFormat
EPS, SaveFormat
GIF, SaveFormat
TIF]
octaveCommand :: OutputSpec -> PlotM Text
octaveCommand :: OutputSpec -> PlotM Text
octaveCommand OutputSpec{..} = do
FilePath
exe <- Toolkit -> PlotM FilePath
executable Toolkit
Octave
Text -> PlotM Text
forall (m :: * -> *) a. Monad m => a -> m a
return [st|#{exe} --no-gui --no-window-system "#{oScriptPath}"|]
octaveAvailable :: PlotM Bool
octaveAvailable :: PlotM Bool
octaveAvailable = do
FilePath
exe <- Toolkit -> PlotM FilePath
executable Toolkit
Octave
Text -> PlotM Bool
commandSuccess [st|#{exe} -h|]
octaveCapture :: FigureSpec -> FilePath -> Script
octaveCapture :: FigureSpec -> FilePath -> Text
octaveCapture FigureSpec{..} fname :: FilePath
fname = [st|
saveas(gcf, '#{fname}')
|]