pandoc-pyplot-2.1.0.0: A Pandoc filter for including figures generated from Matplotlib

Copyright(c) Laurent P René de Cotret 2019
LicenseMIT
Maintainerlaurent.decotret@outlook.com
Stabilityinternal
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Pandoc.Filter.Pyplot.Internal

Contents

Description

This module re-exports internal pandoc-pyplot functionality.

Synopsis

Documentation

data Configuration Source #

Configuration of pandoc-pyplot, describing the default behavior of the filter.

A Configuration is useful when dealing with lots of figures; it avoids repeating the same values.sta

Since: 2.1.0.0

Constructors

Configuration 

Fields

configuration :: FilePath -> IO Configuration Source #

Building configuration from a YAML file. The keys are exactly the same as for Markdown code blocks.

If a key is either not present or unreadable, its value will be set to the default value.

Since: 2.1.0.0

For testing and internal purposes only

inclusionKeys :: [String] Source #

list of all keys related to pandoc-pyplot.

directoryKey :: String Source #

Keys that pandoc-pyplot will look for in code blocks. These are only exported for testing purposes.

captionKey :: String Source #

Keys that pandoc-pyplot will look for in code blocks. These are only exported for testing purposes.

dpiKey :: String Source #

Keys that pandoc-pyplot will look for in code blocks. These are only exported for testing purposes.

includePathKey :: String Source #

Keys that pandoc-pyplot will look for in code blocks. These are only exported for testing purposes.

saveFormatKey :: String Source #

Keys that pandoc-pyplot will look for in code blocks. These are only exported for testing purposes.

data FigureSpec Source #

Datatype containing all parameters required to run pandoc-pyplot

Constructors

FigureSpec 

Fields

Instances
Hashable FigureSpec Source # 
Instance details

Defined in Text.Pandoc.Filter.Pyplot.FigureSpec

saveFormatFromString :: String -> Maybe SaveFormat Source #

Parse an image save format string

>>> saveFormatFromString ".png"
Just PNG
>>> saveFormatFromString "jpeg"
Just JPEG
>>> SaveFormatFromString "arbitrary"
Nothing

toImage :: FigureSpec -> Block Source #

Convert a FigureSpec to a Pandoc block component

sourceCodePath :: FigureSpec -> FilePath Source #

Determine the path to the source code that generated the figure.

figurePath :: FigureSpec -> FilePath Source #

Determine the path a figure should have.

addPlotCapture Source #

Arguments

:: FigureSpec

Path where to save the figure

-> PythonScript

Code block with added capture

Modify a Python plotting script to save the figure to a filename. An additional file will also be captured.

extension :: SaveFormat -> String Source #

Save format file extension

runTempPythonScript Source #

Arguments

:: String

Interpreter (e.g. "python" or "python35")

-> PythonScript

Content of the script

-> IO ScriptResult

Result with exit code.

Take a python script in string form, write it in a temporary directory, then execute it.

hasBlockingShowCall :: PythonScript -> Bool Source #

Detect the presence of a blocking show call, for example "plt.show()"

type PythonScript = Text Source #

String representation of a Python script

data ScriptResult Source #

Possible result of running a Python script