-- 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.1.0.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 makePlot that can be used -- to walk over a Pandoc document and generate figures from Python code -- blocks. -- -- The syntax for code blocks is simple, Code blocks with the -- plot_target=... attribute will trigger the filter. The code -- block will be reworked into a Python script and the output figure will -- be captured. -- -- Here are the possible attributes what pandoc-pyplot understands: -- -- -- -- Here are some example blocks in Markdown: -- --
--   This is a paragraph
--   
--   ```{plot_target=my_figure.jpg plot_alt="This is a caption."}
--   import matplotlib.pyplot as plt
--   
--   plt.figure()
--   plt.plot([0,1,2,3,4], [1,2,3,4,5])
--   plt.title('This is an example figure')
--   ```
--   
module Text.Pandoc.Filter.Pyplot -- | Highest-level function that can be walked over a Pandoc tree. All code -- blocks that have the plot_target parameter will be considered -- figures. makePlot :: Block -> IO Block -- | Main routine to include Matplotlib plots. Code blocks containing the -- attributes plot_target 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 instance GHC.Classes.Eq Text.Pandoc.Filter.Pyplot.PandocPyplotError instance GHC.Show.Show Text.Pandoc.Filter.Pyplot.PandocPyplotError