pandoc-plot 1.6.1 → 1.6.2
raw patch · 12 files changed
+24/−111 lines, 12 filesdep −criteriondep ~basedep ~mtldep ~pandoc-typesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: criterion
Dependency ranges changed: base, mtl, pandoc-types, text
API changes (from Hackage documentation)
- Text.Pandoc.Filter.Plot.Internal: data PlotState
+ Text.Pandoc.Filter.Plot.Internal: newtype PlotState
Files
- CHANGELOG.md +4/−0
- benchmark/MatplotlibGallery.hs +0/−23
- benchmark/bench.hs +0/−56
- pandoc-plot.cabal +12/−21
- src/Text/Pandoc/Filter/Plot.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Clean.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Monad.hs +3/−3
- src/Text/Pandoc/Filter/Plot/Monad/Logging.hs +0/−1
- src/Text/Pandoc/Filter/Plot/Monad/Types.hs +0/−1
- src/Text/Pandoc/Filter/Plot/Parse.hs +1/−1
- src/Text/Pandoc/Filter/Plot/Renderers.hs +1/−2
- src/Text/Pandoc/Filter/Plot/Scripting.hs +1/−1
CHANGELOG.md view
@@ -2,6 +2,10 @@ pandoc-plot uses [Semantic Versioning](http://semver.org/spec/v2.0.0.html) +## Release 1.6.2++* Fixed some imports which were removed in `mtl-2.3`.+ ## Release 1.6.1 * Fixed an issue where figure attributes were lost, which prevent other filters (e.g. pandoc-crossref) from working in conjunction with pandoc-plot.
− benchmark/MatplotlibGallery.hs
@@ -1,23 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--module MatplotlibGallery where--import Data.String (fromString)-import qualified Data.Text as T-import qualified Data.Text.IO as T-import Language.Haskell.TH.Syntax--galleryItem :: FilePath -> Q Exp-galleryItem fp = do- qAddDependentFile fp- txt <- runIO $ T.readFile fp- strToExp $ T.unpack txt- where- strToExp :: String -> Q Exp- strToExp s = return $ VarE 'fromString `AppE` LitE (StringL s)--galleryItem1, galleryItem2, galleryItem3, galleryItem4 :: Q Exp-galleryItem1 = galleryItem "benchmark/gallery_item_1.py"-galleryItem2 = galleryItem "benchmark/gallery_item_2.py"-galleryItem3 = galleryItem "benchmark/gallery_item_3.py"-galleryItem4 = galleryItem "benchmark/gallery_item_4.py"
− benchmark/bench.hs
@@ -1,56 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--import Criterion.Main- ( bench,- bgroup,- defaultMain,- envWithCleanup,- nfIO,- )-import MatplotlibGallery- ( galleryItem1,- galleryItem2,- galleryItem3,- galleryItem4,- )-import Text.Pandoc.Definition (Block (CodeBlock), Pandoc (..))-import Text.Pandoc.Filter.Plot- ( Configuration (logSink, logVerbosity),- LogSink (StdErr),- Script,- Toolkit (Matplotlib),- Verbosity (Silent),- cleanOutputDirs,- defaultConfiguration,- plotFilter,- )-import Text.Pandoc.Filter.Plot.Internal (cls)--main :: IO ()-main =- defaultMain- [ envWithCleanup (return ()) (\_ -> cleanupEnv) $ \_ ->- bgroup- "main"- [ bench "filter" $ nfIO (plotFilter plotConfig Nothing benchDoc)- ]- ]--plotConfig :: Configuration-plotConfig = defaultConfiguration {logVerbosity = Silent, logSink = StdErr}--cleanupEnv :: IO ()-cleanupEnv = cleanOutputDirs plotConfig benchDoc >> return ()--codeBlock :: Script -> Block-codeBlock = CodeBlock (mempty, [cls Matplotlib], mempty)--benchDoc :: Pandoc-benchDoc =- Pandoc- mempty- [ codeBlock $(galleryItem1),- codeBlock $(galleryItem2),- codeBlock $(galleryItem3),- codeBlock $(galleryItem4)- ]
pandoc-plot.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: pandoc-plot-version: 1.6.1+version: 1.6.2 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 @@ -16,10 +16,10 @@ build-type: Simple tested-with: GHC == 8.10.4, GHC == 9.0.1, - GHC == 9.0.1, GHC == 9.2.1, GHC == 9.2.2,- GHC == 9.4.4+ GHC == 9.4.4,+ GHC == 9.6.1 extra-source-files: CHANGELOG.md LICENSE@@ -90,6 +90,13 @@ ghc-options: -Wall -Wcompat+ -Widentities+ -Wincomplete-uni-patterns+ -Wincomplete-record-updates+ -Wredundant-constraints+ -fhide-source-paths+ -Wmissing-export-lists+ -Wpartial-fields build-depends: aeson >= 2 && <3 , base >= 4.11 && <5@@ -111,7 +118,7 @@ , yaml >= 0.8 && < 1 , mtl >= 2.2 && < 3 if !os(windows)- build-depends: unix >= 2.4 && < 2.8+ build-depends: unix >= 2.4 && < 2.9 default-language: Haskell2010 executable pandoc-plot@@ -143,8 +150,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: tests main-is: Main.hs- other-modules:- Common+ other-modules: Common build-depends: base >= 4.11 && < 5 , containers , directory@@ -156,19 +162,4 @@ , tasty-hunit , tasty-hspec , text- default-language: Haskell2010- -benchmark benchmark-pandoc-plot- type: exitcode-stdio-1.0- main-is: bench.hs- other-modules:- MatplotlibGallery- hs-source-dirs: benchmark- build-depends: base- , pandoc-plot- , pandoc-types- , criterion >= 1.0 && < 2- , template-haskell > 2.7 && < 3- , text- ghc-options: -Wall -Wcompat -rtsopts -O2 -threaded -with-rtsopts=-N default-language: Haskell2010
src/Text/Pandoc/Filter/Plot.hs view
@@ -100,7 +100,7 @@ where import Control.Concurrent (getNumCapabilities)-import Control.Monad.Reader (when)+import Control.Monad (when) import Data.Functor ((<&>)) import Data.Map (singleton) import Data.Text (Text, pack, unpack)
src/Text/Pandoc/Filter/Plot/Clean.hs view
@@ -18,7 +18,7 @@ where -- TODO: forConcurrently-import Control.Monad.Reader (forM)+import Control.Monad (forM) import qualified Data.ByteString.Lazy as B import Data.Char (toLower) import Data.Default (def)
src/Text/Pandoc/Filter/Plot/Monad.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeSynonymInstances #-} -- | -- Module : $header$@@ -74,6 +73,7 @@ evalStateT, ) import Data.ByteString.Lazy (toStrict)+import Data.Functor ((<&>)) import Data.Hashable (hash) import Data.Map.Strict (Map) import qualified Data.Map.Strict as M@@ -233,7 +233,7 @@ -- hashes. type FileHash = Word -data PlotState+newtype PlotState = PlotState (MVar (Map FilePath FileHash)) @@ -267,7 +267,7 @@ -- | Find an executable. executable :: Toolkit -> PlotM Executable-executable tk = exeSelector tk >>= return . exeFromPath+executable tk = exeSelector tk <&> exeFromPath where exeSelector Matplotlib = asksConfig matplotlibExe exeSelector PlotlyPython = asksConfig plotlyPythonExe
src/Text/Pandoc/Filter/Plot/Monad/Logging.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-} -- | -- Module : $header$
src/Text/Pandoc/Filter/Plot/Monad/Types.hs view
@@ -1,6 +1,5 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-} -- | -- Module : $header$
src/Text/Pandoc/Filter/Plot/Parse.hs view
@@ -83,7 +83,7 @@ saveFormat = maybe (defaultSaveFormat conf) (fromString . unpack) (Map.lookup (tshow SaveFormatK) attrs') -- Check if the saveformat is compatible with the toolkit- if not (saveFormat `elem` rendererSupportedSaveFormats) + if saveFormat `notElem` rendererSupportedSaveFormats then do err $ pack $ mconcat ["Save format ", show saveFormat, " not supported by ", show toolkit] return $ UnsupportedSaveFormat toolkit saveFormat
src/Text/Pandoc/Filter/Plot/Renderers.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE RecordWildCards #-} -- | -- Module : $header$@@ -162,7 +161,7 @@ isAvailable :: Executable -> AvailabilityCheck -> PlotM Bool isAvailable exe (CommandSuccess f) = commandSuccess (f exe)- isAvailable exe (ExecutableExists) = liftIO $ findExecutable (pathToExe exe) <&> isJust+ isAvailable exe ExecutableExists = liftIO $ findExecutable (pathToExe exe) <&> isJust -- | Monadic version of @unavailableToolkits@ unavailableToolkitsM :: PlotM [Toolkit]
src/Text/Pandoc/Filter/Plot/Scripting.hs view
@@ -162,7 +162,7 @@ -- For example, changing the caption should not require running the figure again. figureContentHash :: FigureSpec -> PlotM Word figureContentHash FigureSpec {..} = do- dependenciesHash <- sequence $ fileHash <$> dependencies+ dependenciesHash <- mapM fileHash dependencies -- hash looks strange because instances only exist for 7-tuples or less return $ fromIntegral $