pandoc-pyplot 1.0.0.0 → 1.0.0.1
raw patch · 5 files changed
+39/−7 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +8/−4
- package.yaml +1/−1
- pandoc-pyplot.cabal +2/−2
- src/Text/Pandoc/Filter/Pyplot.hs +14/−0
- src/Text/Pandoc/Filter/Scripting.hs +14/−0
README.md view
@@ -1,6 +1,6 @@ # pandoc-pyplot -[](https://ci.appveyor.com/project/LaurentRDC/pandoc-pyplot) +[](http://hackage.haskell.org/package/pandoc-pyplot) [](http://stackage.org/nightly/package/pandoc-pyplot) [](https://ci.appveyor.com/project/LaurentRDC/pandoc-pyplot) _A Pandoc filter for generating figures with Matplotlib from code directly in documents_ @@ -37,7 +37,7 @@ or ```bash -pandoc --filter pandoc-pyplot input.md output.pdf +pandoc --filter pandoc-pyplot input.md --output output.pdf ``` or any other output format you want. There are more examples in the source repository, in the `\examples` directory. @@ -62,7 +62,7 @@ ## Requirements -This filter only works with the Matplotlib plotting library. Therefore, you need [Matplotlib](matplotlib.org) and a Python interpreter. The python interpreter is expected to be discoverable using the name `"python"` (as opposed to `"python3"`, for example) +This filter only works with the Matplotlib plotting library. Therefore, you a Python interpreter and at least [Matplotlib](https://matplotlib.org/) installed. The python interpreter is expected to be discoverable using the name `"python"` (as opposed to `"python3"`, for example) ## Running the filter @@ -128,6 +128,10 @@ (unsafeCompiler . plotTransform) ``` +## Warning + +Do not run this filter on unknown documents. There is nothing in `pandoc-pyplot` that can stop a Python script from performing evil actions. This is the reason this package is deemed __unsafe__ in the parlance of [Safe Haskell](https://ghc.haskell.org/trac/ghc/wiki/SafeHaskell). + ## Aknowledgements -This package is inspired from [`pandoc-include-code`](https://github.com/owickstrom/pandoc-include-code).+This package is inspired from [`pandoc-include-code`](https://github.com/owickstrom/pandoc-include-code).
package.yaml view
@@ -1,5 +1,5 @@ name: pandoc-pyplot-version: '1.0.0.0'+version: '1.0.0.1' github: "LaurentRDC/pandoc-pyplot" license: MIT author: "Laurent P. René de Cotret"
pandoc-pyplot.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 057cfdb19c595e350f99205195ae2e446cc16a377c1fd0633b87ad68ae4bdc98+-- hash: 86659e92666d842eaf1742bd04d9e7ba408b1a4923a90e88fd641dbfe6a7a0d0 name: pandoc-pyplot-version: 1.0.0.0+version: 1.0.0.1 synopsis: A Pandoc filter for including figures generated from Matplotlib description: 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. category: Documentation
src/Text/Pandoc/Filter/Pyplot.hs view
@@ -1,5 +1,18 @@ {-# LANGUAGE MultiWayIf #-} +{-# LANGUAGE Unsafe #-} +{-| +Module : Text.Pandoc.Filter.Pyplot +Description : Pandoc filter to create Matplotlib figures from code blocks +Copyright : (c) Laurent P René de Cotret, 2018 +License : MIT +Maintainer : laurent.decotret@outlook.com +Stability : stable +Portability : portable +This module defines a Pandoc filter @makePlot@ that can be +used to walk over a Pandoc document and generate figures from +Python code blocks. +-} module Text.Pandoc.Filter.Pyplot ( makePlot , makePlot' @@ -15,6 +28,7 @@ import Text.Pandoc.Filter.Scripting +-- | Possible errors returned by the filter data PandocPyplotError = ScriptError Int -- ^ Running Python script has yielded an error | InvalidTargetError FilePath -- ^ Invalid figure path | BlockingCallError -- ^ Python script contains a block call to 'show()'
src/Text/Pandoc/Filter/Scripting.hs view
@@ -1,4 +1,16 @@+{-# LANGUAGE Unsafe #-} +{-| +Module : Text.Pandoc.Filter.Scripting +Copyright : (c) Laurent P René de Cotret, 2018 +License : MIT +Maintainer : laurent.decotret@outlook.com +Stability : internal +Portability : portable +This module defines types and functions that help +with running Python scripts. +-} + module Text.Pandoc.Filter.Scripting ( runTempPythonScript , addPlotCapture @@ -15,8 +27,10 @@ import Data.Monoid (Any(..)) +-- | String representation of a Python script type PythonScript = String +-- | Possible result of running a Python script data ScriptResult = ScriptSuccess | ScriptFailure Int