pandoc-utils 0.6.1 → 0.7.0
raw patch · 5 files changed
+24/−20 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Text.Pandoc.Filter.Utils: seqFilters :: Foldable t => t (PartialFilter p) -> p -> p
- Text.Pandoc.Filter.Utils: seqFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -> p -> m p
- Text.Pandoc.Utils: seqFilters :: Foldable t => t (PartialFilter p) -> p -> p
- Text.Pandoc.Utils: seqFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -> p -> m p
+ Text.Pandoc.Filter.Utils: sequenceFilters :: Foldable t => t (PartialFilter p) -> p -> p
+ Text.Pandoc.Filter.Utils: sequenceFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -> p -> m p
+ Text.Pandoc.Utils: sequenceFilters :: Foldable t => t (PartialFilter p) -> p -> p
+ Text.Pandoc.Utils: sequenceFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -> p -> m p
Files
- CHANGELOG.md +4/−0
- README.md +2/−2
- pandoc-utils.cabal +1/−1
- src/Text/Pandoc/Filter/Utils.hs +10/−10
- test/Spec.hs +7/−7
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Releases +## pandoc-utils 0.7.0 (2020-5-24)++- Rename `seqFilters` to `sequenceFilters` to avoid conflict with `seq`.+ ## pandoc-utils 0.6.1 (2020-5-24) - Fix the reference to `applyFilters` in readme.
README.md view
@@ -80,7 +80,7 @@ This function is slightly more powerful than `walk` and `walkM` in that it is also able to handle filter functions of type `a -> [a]` and `a -> m [a]`. -For applying multiple filters, there is also a function called `seqFilters`,+For applying multiple filters, there is also a function called `sequenceFilters`, which takes a list of wrapped filters and apply it to a `Pandoc` document (or subnode) sequentially, from left to right. ```haskell@@ -95,7 +95,7 @@ -> Either PandocError Text -- ^ Html string or error mdToHtml' md = runPure $ do doc <- readMarkdown def md- let doc' = seqFilters myFilters doc+ let doc' = sequenceFilters myFilters doc writeHtml5String def doc' ```
pandoc-utils.cabal view
@@ -2,7 +2,7 @@ cabal-version: 2.0 name: pandoc-utils-version: 0.6.1+version: 0.7.0 synopsis: Utility functions to work with Pandoc in Haskell applications. description:
src/Text/Pandoc/Filter/Utils.hs view
@@ -27,9 +27,9 @@ mkConcatedFilter, -- * Wrapped filter application/composition applyFilter,- seqFilters,+ sequenceFilters, applyFilterM,- seqFiltersM,+ sequenceFiltersM, -- * Wrapped filter → filter function getFilter, getConcatedFilter,@@ -180,22 +180,22 @@ -- | Apply a list of monadic wrapped filters sequentially, from left to right, -- i.e. the first element in the list will be applied first and the last -- element will be applied at the end.-seqFiltersM+sequenceFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -- ^ A list of monadic wrapped filters. -> p -- ^ 'Pandoc' AST node. -> m p -- ^ Transformed node.-seqFiltersM = applyFilterM . fold+sequenceFiltersM = applyFilterM . fold -- | Apply a list of wrapped filters sequentially, from left to right, i.e. -- the first element in the list will be applied first and the last element -- will be applied at the end.-seqFilters+sequenceFilters :: (Foldable t) => t (PartialFilter p) -- ^ A list of wrapped filter. -> p -- ^ 'Pandoc' AST node. -> p -- ^ Transformed node.-seqFilters = applyFilter . fold+sequenceFilters = applyFilter . fold -- | It is mostly the same as 'applyFiltersM', which converts a list of wrapped -- monadic filter to a monadic filter function, but it should be used when you@@ -249,22 +249,22 @@ -- | Apply a list of monadic wrapped filters sequentially, from left to right, -- i.e. the first element in the list will be applied first and the last -- element will be applied at the end.-{-# DEPRECATED applyFiltersM "Use 'seqFiltersM' instead." #-}+{-# DEPRECATED applyFiltersM "Use 'sequenceFiltersM' instead." #-} applyFiltersM :: (Foldable t, Monad m) => t (PartialFilterM m p) -- ^ A list of monadic wrapped filters. -> p -- ^ 'Pandoc' AST node. -> m p -- ^ Transformed node.-applyFiltersM = seqFiltersM+applyFiltersM = sequenceFiltersM -- | Apply a list of wrapped filters sequentially, from left to right, i.e. -- the first element in the list will be applied first and the last element -- will be applied at the end.-{-# DEPRECATED applyFilters "Use 'seqFilters' instead. This function will conflict with a function with the same name in Pandoc." #-}+{-# DEPRECATED applyFilters "Use 'sequenceFilters' instead. This function will conflict with a function with the same name in Pandoc." #-} applyFilters :: (Foldable t) => t (PartialFilter p) -- ^ A list of wrapped filter. -> p -- ^ 'Pandoc' AST node. -> p -- ^ Transformed node.-applyFilters = seqFilters+applyFilters = sequenceFilters
test/Spec.hs view
@@ -174,7 +174,7 @@ -> Either P.PandocError Text -- ^ Html string or error mdToHtml md = P.runPure $ do doc <- P.readMarkdown def md- let doc' = seqFilters [beheadFilter, delinkFilter] doc+ let doc' = sequenceFilters [beheadFilter, delinkFilter] doc P.writeHtml5String def doc' mdToHtmlCompose@@ -334,7 +334,7 @@ it "applys merge correctly" $ applyFilter merge compPara2 `shouldBe` expectedMerge - describe "seqFilters" $ do+ describe "sequenceFilters" $ do it "applys PartialFilter composition from left to right" $ do applyFilter (dup <> merge) compPara `shouldBe` expectedDupMerge applyFilter (merge <> dup) compPara `shouldBe` expectedMergeDup@@ -350,15 +350,15 @@ describe "monoid instance" $ do it "applys PartialFilter composition from left to right" $ do- seqFilters [dup, merge] compPara `shouldBe` expectedDupMerge- seqFilters [merge, dup] compPara `shouldBe` expectedMergeDup+ sequenceFilters [dup, merge] compPara `shouldBe` expectedDupMerge+ sequenceFilters [merge, dup] compPara `shouldBe` expectedMergeDup it "applys PartialFilterM composition from left to right" $ do- let (doc, s) = runWriter $ seqFiltersM [extract, toFilterM dup] compPara+ let (doc, s) = runWriter $ sequenceFiltersM [extract, toFilterM dup] compPara doc `shouldBe` expectedDup s `shouldBe` T.pack "abcd" - let (doc', s') = runWriter $ seqFiltersM [toFilterM dup, extract] compPara+ let (doc', s') = runWriter $ sequenceFiltersM [toFilterM dup, extract] compPara doc' `shouldBe` expectedDup s' `shouldBe` T.pack "abcdabcd" @@ -397,7 +397,7 @@ readmeSpec = parallel $ describe "readme example" $ do it "processes filter examples correctly on AST level" $ do- seqFilters [beheadFilter, delinkFilter] readmeDoc `shouldBe` expectedDoc+ sequenceFilters [beheadFilter, delinkFilter] readmeDoc `shouldBe` expectedDoc applyFilter myFilter readmeDoc `shouldBe` expectedDoc (delinkPandoc . beheadPandoc) readmeDoc `shouldBe` expectedDoc