-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A Pandoc filter for including figures generated from Matplotlib
--   
--   A pandoc filter for including figures generated from Matplotlib. Keep
--   the document and Python code in the same location. Output from
--   Matplotlib is captured and included as a figure.
@package pandoc-pyplot
@version 1.0.3.0


-- | This module defines types and functions that help with running Python
--   scripts.
module Text.Pandoc.Filter.Scripting

-- | Take a python script in string form, write it in a temporary
--   directory, then execute it.
runTempPythonScript :: PythonScript -> IO ScriptResult

-- | Modify a Python plotting script to save the figure to a filename.
addPlotCapture :: FilePath -> PythonScript -> PythonScript

-- | Detect the presence of a blocking show call, for example "plt.show()"
hasBlockingShowCall :: PythonScript -> Bool

-- | String representation of a Python script
type PythonScript = String

-- | Possible result of running a Python script
data ScriptResult
ScriptSuccess :: ScriptResult
ScriptFailure :: Int -> ScriptResult


-- | This module defines a Pandoc filter <tt>makePlot</tt> that can be used
--   to walk over a Pandoc document and generate figures from Python code
--   blocks.
module Text.Pandoc.Filter.Pyplot

-- | Highest-level function that can be walked over a Pandoc tree. All code
--   blocks that have the <tt>plot_target</tt> parameter will be considered
--   figures.
makePlot :: Block -> IO Block

-- | Main routine to include Matplotlib plots. Code blocks containing the
--   attributes <tt>plot_target</tt> are considered Python plotting
--   scripts. All other possible blocks are ignored. The source code is
--   also saved in another file, which can be access by clicking the image
makePlot' :: Block -> IO (Either PandocPyplotError Block)

-- | Walk over an entire Pandoc document, changing appropriate code blocks
--   into figures.
plotTransform :: Pandoc -> IO Pandoc

-- | Possible errors returned by the filter
data PandocPyplotError

-- | Running Python script has yielded an error
ScriptError :: Int -> PandocPyplotError

-- | Invalid figure path
InvalidTargetError :: FilePath -> PandocPyplotError

-- | Directory where to save figure does not exist
MissingDirectoryError :: FilePath -> PandocPyplotError

-- | Python script contains a block call to 'show()'
BlockingCallError :: PandocPyplotError

-- | Translate filter error to an error message
showError :: PandocPyplotError -> String
