{-# 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 -> PlotM Text
octaveCommand OutputSpec{..} = do
exe <- executable Octave
return [st|#{exe} --no-gui --no-window-system "#{oScriptPath}"|]
octaveAvailable :: PlotM Bool
octaveAvailable = do
exe <- executable Octave
commandSuccess [st|#{exe} -h|]
octaveCapture :: FigureSpec -> FilePath -> Script
octaveCapture _ fname = [st|
saveas(gcf, '#{fname}')
|]