pandoc-plot 0.2.1.0 → 0.2.2.0
raw patch · 11 files changed
+58/−21 lines, 11 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- README.md +39/−5
- pandoc-plot.cabal +1/−1
- src/Text/Pandoc/Filter/Plot.hs +0/−2
- src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Types.hs +6/−7
CHANGELOG.md view
@@ -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 ---------------
README.md view
@@ -2,7 +2,7 @@ ## A Pandoc filter to generate figures from code blocks in documents -[](http://hackage.haskell.org/package/pandoc-plot) [](http://stackage.org/nightly/package/pandoc-plot) [](https://ci.appveyor.com/project/LaurentRDC/pandoc-plot) [](https://dev.azure.com/laurentdecotret/pandoc-plot/_build/latest?definitionId=5&branchName=master)  +[](http://hackage.haskell.org/package/pandoc-plot) [](http://stackage.org/nightly/package/pandoc-plot) [](https://ci.appveyor.com/project/LaurentRDC/pandoc-plot) [](https://dev.azure.com/laurentdecotret/pandoc-plot/_build/latest?definitionId=5&branchName=master)  [](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 @@ * `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) -*Coming soon* +Windows binaries and installers are available on the [GitHub release page](https://github.com/LaurentRDC/pandoc-plot/releases). -### Installers (Windows) +### conda -*Coming soon* +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). + +To install in the current environment: + +```sh +conda install -c conda-forge pandoc-plot +``` ### From Hackage/Stackage
pandoc-plot.cabal view
@@ -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.
src/Text/Pandoc/Filter/Plot.hs view
@@ -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
src/Text/Pandoc/Filter/Plot/Renderers/GGPlot2.hs view
@@ -27,7 +27,7 @@ ggplot2Command :: Configuration -> FigureSpec -> FilePath -> Text -ggplot2Command Configuration{..} _ fp = [st|#{ggplot2Exe} #{fp}|] +ggplot2Command Configuration{..} _ fp = [st|#{ggplot2Exe} "#{fp}"|] ggplot2Available :: Configuration -> IO Bool
src/Text/Pandoc/Filter/Plot/Renderers/GNUPlot.hs view
@@ -27,7 +27,7 @@ gnuplotCommand :: Configuration -> FigureSpec -> FilePath -> Text -gnuplotCommand Configuration{..} _ fp = [st|#{gnuplotExe} -c #{fp}|] +gnuplotCommand Configuration{..} _ fp = [st|#{gnuplotExe} -c "#{fp}"|] gnuplotAvailable :: Configuration -> IO Bool
src/Text/Pandoc/Filter/Plot/Renderers/Mathematica.hs view
@@ -27,7 +27,7 @@ mathematicaCommand :: Configuration -> FigureSpec -> FilePath -> Text -mathematicaCommand Configuration{..} _ fp = [st|#{mathematicaExe} -script #{fp}|] +mathematicaCommand Configuration{..} _ fp = [st|#{mathematicaExe} -script "#{fp}"|] mathematicaAvailable :: Configuration -> IO Bool
src/Text/Pandoc/Filter/Plot/Renderers/Matplotlib.hs view
@@ -35,7 +35,7 @@ matplotlibCommand :: Configuration -> FigureSpec -> FilePath -> Text -matplotlibCommand Configuration{..} _ fp = [st|#{matplotlibExe} #{fp}|] +matplotlibCommand Configuration{..} _ fp = [st|#{matplotlibExe} "#{fp}"|] matplotlibCapture :: FigureSpec -> FilePath -> Script
src/Text/Pandoc/Filter/Plot/Renderers/Octave.hs view
@@ -28,7 +28,7 @@ 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
src/Text/Pandoc/Filter/Plot/Renderers/Plotly.hs view
@@ -28,7 +28,7 @@ plotlyPythonCommand :: Configuration -> FigureSpec -> FilePath -> Text -plotlyPythonCommand Configuration{..} _ fp = [st|#{plotlyPythonExe} #{fp}|] +plotlyPythonCommand Configuration{..} _ fp = [st|#{plotlyPythonExe} "#{fp}"|] plotlyPythonAvailable :: Configuration -> IO Bool
src/Text/Pandoc/Filter/Plot/Types.hs view
@@ -96,7 +96,7 @@ , 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 @@ , 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 @@ , 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 @@ , defaultWithSource = False , defaultDPI = 80 , defaultSaveFormat = PNG - -- toolkit-specific default preambles + , matplotlibPreamble = mempty , plotlyPythonPreamble= mempty , matlabPreamble = mempty @@ -131,8 +131,7 @@ , 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 @@ , octaveExe = "octave" , ggplot2Exe = "Rscript" , gnuplotExe = "gnuplot" - -- Toolkit-specific + , matplotlibTightBBox = False , matplotlibTransparent = False }