summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurentRDC <>2020-04-07 11:38:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2020-04-07 11:38:00 (GMT)
commit1bf9ab0db9a29b57649d587ee1721c17bc9cef9d (patch)
tree5c4c8cef3e4f761eea5b7fa3445c25b92f632bbc
parent601cd3ff6362b106496aa5196e7abd4502047bb6 (diff)
version 0.2.2.00.2.2.0
-rw-r--r--CHANGELOG.md6
-rw-r--r--README.md44
-rw-r--r--pandoc-plot.cabal2
-rw-r--r--src/Text/Pandoc/Filter/Plot.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs2
-rw-r--r--src/Text/Pandoc/Filter/Plot/Types.hs13
11 files changed, 58 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a664963..49f7b0a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,12 @@
pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
+Release 0.2.2.0
+---------------
+
+* Fixed an issue where paths with spaces would not work (issue #2).
+* Added Linux binaries built via Azure pipelines.
+
Release 0.2.1.0
---------------
diff --git a/README.md b/README.md
index 50df0f1..9c07033 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
## A Pandoc filter to generate figures from code blocks in documents
-[![Hackage version](https://img.shields.io/hackage/v/pandoc-plot.svg)](http://hackage.haskell.org/package/pandoc-plot) [![Stackage version (nightly)](http://stackage.org/package/pandoc-plot/badge/nightly)](http://stackage.org/nightly/package/pandoc-plot) [![Build status](https://ci.appveyor.com/api/projects/status/mmgiuk52j356e6jp?svg=true)](https://ci.appveyor.com/project/LaurentRDC/pandoc-plot) [![Build Status](https://dev.azure.com/laurentdecotret/pandoc-plot/_apis/build/status/LaurentRDC.pandoc-plot?branchName=master)](https://dev.azure.com/laurentdecotret/pandoc-plot/_build/latest?definitionId=5&branchName=master) ![GitHub](https://img.shields.io/github/license/LaurentRDC/pandoc-plot)
+[![Hackage version](https://img.shields.io/hackage/v/pandoc-plot.svg)](http://hackage.haskell.org/package/pandoc-plot) [![Stackage version (nightly)](http://stackage.org/package/pandoc-plot/badge/nightly)](http://stackage.org/nightly/package/pandoc-plot) [![Build status](https://ci.appveyor.com/api/projects/status/mmgiuk52j356e6jp?svg=true)](https://ci.appveyor.com/project/LaurentRDC/pandoc-plot) [![Build Status](https://dev.azure.com/laurentdecotret/pandoc-plot/_apis/build/status/LaurentRDC.pandoc-plot?branchName=master)](https://dev.azure.com/laurentdecotret/pandoc-plot/_build/latest?definitionId=5&branchName=master) ![GitHub](https://img.shields.io/github/license/LaurentRDC/pandoc-plot) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pandoc-plot.svg)](https://anaconda.org/conda-forge/pandoc-plot)
`pandoc-plot` turns code blocks present in your documents (Markdown, LaTeX, etc.) into embedded figures, using your plotting toolkit of choice, including Matplotlib, ggplot2, MATLAB, Mathematica, and more.
@@ -18,6 +18,7 @@
* [Compatibility with pandoc-crossref](#compatibility-with-pandoc-crossref)
* [Configuration](#configuration)
* [Toolkit-specific options](#toolkit-specific-options)
+* [Usage as a Haskell library](#usage-as-a-haskell-library)
* [Installation](#installation)
* [Warning](#warning)
@@ -272,15 +273,48 @@ matlabplot:
* `tight_bbox` is a boolean that determines whether to use `bbox_inches="tight"` or not when saving Matplotlib figures. For example, `tight_bbox: true`. See [here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.savefig.html) for details.
* `transparent` is a boolean that determines whether to make Matplotlib figure background transparent or not. This is useful, for example, for displaying a plot on top of a colored background on a web page. High-resolution figures are not affected. For example, `transparent: true`.
+## Usage as a Haskell library
+
+To include the functionality of `pandoc-plot` in a Haskell package, you can use the `makePlot` function (for single blocks) or `plotTransform` function (for entire documents). [Take a look at the documentation on Hackage](https://hackage.haskell.org/package/pandoc-plot).
+
+### Usage with Hakyll
+
+In case you want to use the filter with your own Hakyll setup, you can use a transform function that works on entire documents:
+
+```haskell
+import Text.Pandoc.Filter.Plot (plotTransform)
+
+import Data.Default (def) -- From data-default package, for default configuration
+import Hakyll
+
+-- Unsafe compiler is required because of the interaction
+-- in IO (i.e. running an external script).
+makePlotPandocCompiler :: Compiler (Item String)
+makePlotPandocCompiler =
+ pandocCompilerWithTransformM
+ defaultHakyllReaderOptions
+ defaultHakyllWriterOptions
+ (unsafeCompiler . plotTransform def fmt)
+ where
+ config = def -- Default configuration
+ fmt = Just "markdown" -- Document format, including extensions
+```
+
## Installation
-### Binaries
+### Binaries and Installers (Windows)
+
+Windows binaries and installers are available on the [GitHub release page](https://github.com/LaurentRDC/pandoc-plot/releases).
-*Coming soon*
+### conda
-### Installers (Windows)
+Like `pandoc`, `pandoc-plot` is available as a package installable with [`conda`](https://docs.conda.io/en/latest/). [Click here to see the package page](https://anaconda.org/conda-forge/pandoc-plot).
-*Coming soon*
+To install in the current environment:
+
+```sh
+conda install -c conda-forge pandoc-plot
+```
### From Hackage/Stackage
diff --git a/pandoc-plot.cabal b/pandoc-plot.cabal
index bbbc5ea..35af4b9 100644
--- a/pandoc-plot.cabal
+++ b/pandoc-plot.cabal
@@ -1,5 +1,5 @@
name: pandoc-plot
-version: 0.2.1.0
+version: 0.2.2.0
cabal-version: >= 1.12
synopsis: A Pandoc filter to include figures generated from code blocks using your plotting toolkit of choice.
description: A Pandoc filter to include figures generated from code blocks. Keep the document and code in the same location. Output is captured and included as a figure.
diff --git a/src/Text/Pandoc/Filter/Plot.hs b/src/Text/Pandoc/Filter/Plot.hs
index 28679b2..d679b91 100644
--- a/src/Text/Pandoc/Filter/Plot.hs
+++ b/src/Text/Pandoc/Filter/Plot.hs
@@ -1,6 +1,4 @@
-{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
-
{-|
Module : $header$
Description : Pandoc filter to create figures from code blocks using your plotting toolkit of choice
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs b/src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs
index 2d61782..9ff3caa 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs
@@ -27,7 +27,7 @@ ggplot2SupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, TIF]
ggplot2Command :: Configuration -> FigureSpec -> FilePath -> Text
-ggplot2Command Configuration{..} _ fp = [st|#{ggplot2Exe} #{fp}|]
+ggplot2Command Configuration{..} _ fp = [st|#{ggplot2Exe} "#{fp}"|]
ggplot2Available :: Configuration -> IO Bool
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs b/src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs
index 033e04d..e488419 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs
@@ -27,7 +27,7 @@ gnuplotSupportedSaveFormats = [PNG, SVG, EPS, GIF, JPG, PDF]
gnuplotCommand :: Configuration -> FigureSpec -> FilePath -> Text
-gnuplotCommand Configuration{..} _ fp = [st|#{gnuplotExe} -c #{fp}|]
+gnuplotCommand Configuration{..} _ fp = [st|#{gnuplotExe} -c "#{fp}"|]
gnuplotAvailable :: Configuration -> IO Bool
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs b/src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs
index 5660c22..a3c83f1 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs
@@ -27,7 +27,7 @@ mathematicaSupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, GIF, TIF]
mathematicaCommand :: Configuration -> FigureSpec -> FilePath -> Text
-mathematicaCommand Configuration{..} _ fp = [st|#{mathematicaExe} -script #{fp}|]
+mathematicaCommand Configuration{..} _ fp = [st|#{mathematicaExe} -script "#{fp}"|]
mathematicaAvailable :: Configuration -> IO Bool
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs b/src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs
index 11ed1c1..269feeb 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs
@@ -35,7 +35,7 @@ matplotlibSupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, GIF, TIF]
matplotlibCommand :: Configuration -> FigureSpec -> FilePath -> Text
-matplotlibCommand Configuration{..} _ fp = [st|#{matplotlibExe} #{fp}|]
+matplotlibCommand Configuration{..} _ fp = [st|#{matplotlibExe} "#{fp}"|]
matplotlibCapture :: FigureSpec -> FilePath -> Script
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs b/src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs
index 14af9f5..dcc9f34 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs
@@ -28,7 +28,7 @@ octaveSupportedSaveFormats = [PNG, PDF, SVG, JPG, EPS, GIF, TIF]
octaveCommand :: Configuration -> FigureSpec -> FilePath -> Text
-octaveCommand Configuration{..} _ fp = [st|#{octaveExe} --no-gui --no-window-system #{fp}|]
+octaveCommand Configuration{..} _ fp = [st|#{octaveExe} --no-gui --no-window-system "#{fp}"|]
octaveAvailable :: Configuration -> IO Bool
diff --git a/src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs b/src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs
index 50999d5..de4e920 100644
--- a/src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs
+++ b/src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs
@@ -28,7 +28,7 @@ plotlyPythonSupportedSaveFormats = [PNG, JPG, WEBP, PDF, SVG, EPS]
plotlyPythonCommand :: Configuration -> FigureSpec -> FilePath -> Text
-plotlyPythonCommand Configuration{..} _ fp = [st|#{plotlyPythonExe} #{fp}|]
+plotlyPythonCommand Configuration{..} _ fp = [st|#{plotlyPythonExe} "#{fp}"|]
plotlyPythonAvailable :: Configuration -> IO Bool
diff --git a/src/Text/Pandoc/Filter/Plot/Types.hs b/src/Text/Pandoc/Filter/Plot/Types.hs
index 1f99528..0eac3e1 100644
--- a/src/Text/Pandoc/Filter/Plot/Types.hs
+++ b/src/Text/Pandoc/Filter/Plot/Types.hs
@@ -96,7 +96,7 @@ data Configuration = Configuration
, defaultWithSource :: !Bool -- ^ The default behavior of whether or not to include links to source code and high-res
, defaultDPI :: !Int -- ^ The default dots-per-inch value for generated figures. Renderers might ignore this.
, defaultSaveFormat :: !SaveFormat -- ^ The default save format of generated figures.
- -- Default preambles
+
, matplotlibPreamble :: !Script -- ^ The default preamble script for the matplotlib toolkit.
, plotlyPythonPreamble :: !Script -- ^ The default preamble script for the Plotly/Python toolkit.
, matlabPreamble :: !Script -- ^ The default preamble script for the MATLAB toolkit.
@@ -104,7 +104,7 @@ data Configuration = Configuration
, octavePreamble :: !Script -- ^ The default preamble script for the GNU Octave toolkit.
, ggplot2Preamble :: !Script -- ^ The default preamble script for the GGPlot2 toolkit.
, gnuplotPreamble :: !Script -- ^ The default preamble script for the gnuplot toolkit.
- -- Toolkit executables
+
, matplotlibExe :: !FilePath -- ^ The executable to use to generate figures using the matplotlib toolkit.
, matlabExe :: !FilePath -- ^ The executable to use to generate figures using the MATLAB toolkit.
, plotlyPythonExe :: !FilePath -- ^ The executable to use to generate figures using the Plotly/Python toolkit.
@@ -112,7 +112,7 @@ data Configuration = Configuration
, octaveExe :: !FilePath -- ^ The executable to use to generate figures using the GNU Octave toolkit.
, ggplot2Exe :: !FilePath -- ^ The executable to use to generate figures using the GGPlot2 toolkit.
, gnuplotExe :: !FilePath -- ^ The executable to use to generate figures using the gnuplot toolkit.
- -- Toolkit-specific options
+
, matplotlibTightBBox :: !Bool -- ^ Whether or not to make Matplotlib figures tight by default.
, matplotlibTransparent :: !Bool -- ^ Whether or not to make Matplotlib figures transparent by default.
} deriving (Eq, Show)
@@ -123,7 +123,7 @@ instance Default Configuration where
, defaultWithSource = False
, defaultDPI = 80
, defaultSaveFormat = PNG
- -- toolkit-specific default preambles
+
, matplotlibPreamble = mempty
, plotlyPythonPreamble= mempty
, matlabPreamble = mempty
@@ -131,8 +131,7 @@ instance Default Configuration where
, octavePreamble = mempty
, ggplot2Preamble = mempty
, gnuplotPreamble = mempty
- -- Toolkit executables
- -- Default values are executable names as if on the PATH
+
, matplotlibExe = if isWindows then "python" else "python3"
, matlabExe = "matlab"
, plotlyPythonExe = if isWindows then "python" else "python3"
@@ -140,7 +139,7 @@ instance Default Configuration where
, octaveExe = "octave"
, ggplot2Exe = "Rscript"
, gnuplotExe = "gnuplot"
- -- Toolkit-specific
+
, matplotlibTightBBox = False
, matplotlibTransparent = False
}