{-# 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 = [PNG, PDF, SVG, JPG, EPS, GIF, TIF]
octaveCommand :: OutputSpec -> IO Text
octaveCommand OutputSpec{..} = do
exe <- executable Octave oConfiguration
return [st|#{exe} --no-gui --no-window-system "#{oScriptPath}"|]
octaveAvailable :: Configuration -> IO Bool
octaveAvailable conf = do
exe <- executable Octave conf
commandSuccess [st|#{exe} -h|]
octaveCapture :: FigureSpec -> FilePath -> Script
octaveCapture FigureSpec{..} fname = [st|
saveas(gcf, '#{fname}')
|]