pandoc-plot-0.4.0.1: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.

Copyright(c) Laurent P René de Cotret 2020
LicenseGNU GPL, version 2 or above
Maintainerlaurent.decotret@outlook.com
Stabilityinternal
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Pandoc.Filter.Plot.Internal

Description

This module re-exports internal pandoc-plot functionality. The external use of content from this module is discouraged.

Synopsis

Documentation

data Toolkit Source #

Enumeration of supported toolkits

Instances
Bounded Toolkit Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Enum Toolkit Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Eq Toolkit Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Methods

(==) :: Toolkit -> Toolkit -> Bool #

(/=) :: Toolkit -> Toolkit -> Bool #

Show Toolkit Source #

This instance should only be used to display toolkit names

Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Generic Toolkit Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Associated Types

type Rep Toolkit :: Type -> Type #

Methods

from :: Toolkit -> Rep Toolkit x #

to :: Rep Toolkit x -> Toolkit #

type Rep Toolkit Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

type Rep Toolkit = D1 (MetaData "Toolkit" "Text.Pandoc.Filter.Plot.Types" "pandoc-plot-0.4.0.1-HJeYiesZ6B0BooDoWWpCFC" False) ((C1 (MetaCons "Matplotlib" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Matlab" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "PlotlyPython" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "Mathematica" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Octave" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "GGPlot2" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "GNUPlot" PrefixI False) (U1 :: Type -> Type))))

data PlotEnv Source #

Constructors

PlotEnv 

data Configuration Source #

The Configuration type holds the default values to use when running pandoc-plot. These values can be overridden in code blocks.

Constructors

Configuration 

Fields

data InclusionKey Source #

Description of any possible inclusion key, both in documents and in configuration files.

data FigureSpec Source #

Datatype containing all parameters required to run pandoc-plot.

It is assumed that once a FigureSpec has been created, no configuration can overload it; hence, a FigureSpec completely encodes a particular figure.

Constructors

FigureSpec 

Fields

data SaveFormat Source #

Generated figure file format supported by pandoc-plot. Note that not all formats are supported by all toolkits.

Constructors

PNG 
PDF 
SVG 
JPG 
EPS 
GIF 
TIF 
WEBP 
Instances
Bounded SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Enum SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Eq SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Show SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

IsString SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Generic SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

Associated Types

type Rep SaveFormat :: Type -> Type #

Hashable SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

ToJSON SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

FromJSON SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

type Rep SaveFormat Source # 
Instance details

Defined in Text.Pandoc.Filter.Plot.Types

type Rep SaveFormat = D1 (MetaData "SaveFormat" "Text.Pandoc.Filter.Plot.Types" "pandoc-plot-0.4.0.1-HJeYiesZ6B0BooDoWWpCFC" False) (((C1 (MetaCons "PNG" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "PDF" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "SVG" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "JPG" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "EPS" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "GIF" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "TIF" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "WEBP" PrefixI False) (U1 :: Type -> Type))))

cls :: Toolkit -> Text Source #

Class name which will trigger the filter

extension :: SaveFormat -> String Source #

Save format file extension

inclusionKeys :: [InclusionKey] Source #

List of all keys related to pandoc-plot that can be specified in source material.

preambleSelector :: Toolkit -> Configuration -> Script Source #

The function that maps from configuration to the preamble.

supportedSaveFormats :: Toolkit -> [SaveFormat] Source #

Save formats supported by this renderer.

parseExtraAttrs :: Toolkit -> Map Text Text -> Map Text Text Source #

Parse code block headers for extra attributes that are specific to this renderer. By default, no extra attributes are parsed.

command :: Toolkit -> Configuration -> FigureSpec -> FilePath -> Text Source #

Generate the appropriate command-line command to generate a figure.

capture :: Toolkit -> FigureSpec -> FilePath -> Script Source #

Script fragment required to capture a figure.

toolkitAvailable :: Toolkit -> Configuration -> IO Bool Source #

Check if a toolkit is available, based on the current configuration

availableToolkits :: Configuration -> IO [Toolkit] Source #

List of toolkits available on this machine. The executables to look for are taken from the configuration.

unavailableToolkits :: Configuration -> IO [Toolkit] Source #

List of toolkits not available on this machine. The executables to look for are taken from the configuration.

toImage Source #

Arguments

:: Format

text format of the caption

-> FigureSpec 
-> Block 

Convert a FigureSpec to a Pandoc block component. Note that the script to generate figure files must still be run in another function.

plotToolkit :: Block -> Maybe Toolkit Source #

Determine which toolkit should be used to render the plot from a code block, if any.

parseFigureSpec :: Block -> PlotM (Maybe FigureSpec) Source #

Determine inclusion specifications from Block attributes. If an environment is detected, but the save format is incompatible, an error will be thrown.

captionReader :: Format -> Text -> Maybe [Inline] Source #

Reader a caption, based on input document format

configuration :: FilePath -> IO Configuration Source #

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

If a key is either not present, its value will be set to the default value. Parsing errors result in thrown exceptions.

cleanOutputDirs :: Walkable Block b => Configuration -> b -> IO [FilePath] Source #

Clean all output related to pandoc-plot. This includes output directories specified in the configuration and in the document/block. Note that *all* files in pandoc-plot output directories will be removed.

The cleaned directories are returned.

readDoc :: FilePath -> IO Pandoc Source #

Read document, guessing what extensions and reader options are appropriate. If the file cannot be read for any reason, an error is thrown.