pandoc-types 1.17.5.4 → 1.17.6
raw patch · 11 files changed
+157/−141 lines, 11 filesdep −deepseq-genericsdep ~deepseqPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: deepseq-generics
Dependency ranges changed: deepseq
API changes (from Hackage documentation)
- Text.Pandoc.JSON: instance Text.Pandoc.JSON.ToJSONFilter a => Text.Pandoc.JSON.ToJSONFilter (GHC.Base.Maybe Text.Pandoc.Definition.Format -> a)
+ Text.Pandoc.JSON: instance Text.Pandoc.JSON.ToJSONFilter a => Text.Pandoc.JSON.ToJSONFilter (GHC.Maybe.Maybe Text.Pandoc.Definition.Format -> a)
+ Text.Pandoc.Walk: queryBlock :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> Block -> c
+ Text.Pandoc.Walk: queryCitation :: (Walkable a [Inline], Monoid c) => (a -> c) -> Citation -> c
+ Text.Pandoc.Walk: queryInline :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> Inline -> c
+ Text.Pandoc.Walk: queryMetaValue :: (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> MetaValue -> c
+ Text.Pandoc.Walk: queryPandoc :: (Walkable a Meta, Walkable a [Block], Monoid c) => (a -> c) -> Pandoc -> c
+ Text.Pandoc.Walk: walkBlockM :: (Walkable a [Block], Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Block -> m Block
+ Text.Pandoc.Walk: walkCitationM :: (Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Citation -> m Citation
+ Text.Pandoc.Walk: walkInlineM :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Inline -> m Inline
+ Text.Pandoc.Walk: walkMetaValueM :: (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline], Monad f, Applicative f, Functor f) => (a -> f a) -> MetaValue -> f MetaValue
+ Text.Pandoc.Walk: walkPandocM :: (Walkable a Meta, Walkable a [Block], Monad m, Applicative m, Functor m) => (a -> m a) -> Pandoc -> m Pandoc
- Text.Pandoc.Definition: MetaMap :: (Map String MetaValue) -> MetaValue
+ Text.Pandoc.Definition: MetaMap :: Map String MetaValue -> MetaValue
Files
- LICENSE +1/−1
- Text/Pandoc/Arbitrary.hs +6/−6
- Text/Pandoc/Builder.hs +8/−20
- Text/Pandoc/Definition.hs +11/−33
- Text/Pandoc/Generic.hs +2/−6
- Text/Pandoc/JSON.hs +2/−2
- Text/Pandoc/Walk.hs +104/−55
- benchmark/bench.hs +2/−2
- changelog +12/−0
- pandoc-types.cabal +8/−11
- test/test-pandoc-types.hs +1/−5
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2006-2016, John MacFarlane+Copyright (c) 2006-2019, John MacFarlane All rights reserved.
Text/Pandoc/Arbitrary.hs view
@@ -1,5 +1,5 @@ {-# OPTIONS_GHC -fno-warn-orphans #-}-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, ScopedTypeVariables #-}+{-# LANGUAGE FlexibleInstances, ScopedTypeVariables #-} -- provides Arbitrary instance for Pandoc types module Text.Pandoc.Arbitrary () where@@ -16,9 +16,9 @@ arbAttr :: Gen Attr arbAttr = do id' <- elements ["","loc"]- classes <- elements [[],["haskell"],["c","numberLines"]]+ classes' <- elements [[],["haskell"],["c","numberLines"]] keyvals <- elements [[],[("start","22")],[("a","11"),("b_2","a b c")]]- return (id',classes,keyvals)+ return (id',classes',keyvals) instance Arbitrary Inlines where arbitrary = (fromList :: [Inline] -> Inlines) <$> arbitrary@@ -129,7 +129,7 @@ , (10, Code <$> arbAttr <*> realString) , (5, elements [ RawInline (Format "html") "<a id=\"eek\">" , RawInline (Format "latex") "\\my{command}" ])- ] ++ [ x | x <- nesters, n > 1]+ ] ++ [ x | n > 1, x <- nesters] where nesters = [ (10, Emph <$> arbInlines (n-1)) , (10, Strong <$> arbInlines (n-1)) , (10, Strikeout <$> arbInlines (n-1))@@ -205,7 +205,7 @@ <*> pure nullAttr <*> arbInlines (n-1)) , (2, pure HorizontalRule)- ] ++ [x | x <- nesters, n > 0]+ ] ++ [x | n > 0, x <- nesters] where nesters = [ (5, BlockQuote <$> listOf1 (arbBlock (n-1))) , (5, OrderedList <$> ((,,) <$> (arbitrary `suchThat` (> 0)) <*> arbitrary@@ -269,7 +269,7 @@ return $ setMeta "title" x1 $ setMeta "author" x2 $ setMeta "date" x3- $ nullMeta+ nullMeta instance Arbitrary Alignment where arbitrary
Text/Pandoc/Builder.hs view
@@ -1,8 +1,8 @@-{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses,- DeriveDataTypeable, GeneralizedNewtypeDeriving, CPP, StandaloneDeriving,- DeriveGeneric, DeriveTraversable #-}+{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable,+ GeneralizedNewtypeDeriving, CPP, StandaloneDeriving, DeriveGeneric,+ DeriveTraversable #-} {--Copyright (C) 2010-2016 John MacFarlane+Copyright (C) 2010-2019 John MacFarlane All rights reserved. @@ -36,7 +36,7 @@ {- | Module : Text.Pandoc.Builder- Copyright : Copyright (C) 2010-2016 John MacFarlane+ Copyright : Copyright (C) 2010-2019 John MacFarlane License : BSD3 Maintainer : John MacFarlane <jgm@berkeley.edu>@@ -176,18 +176,7 @@ import Data.Data import Control.Arrow ((***)) import GHC.Generics (Generic)-import Data.Semigroup--#if MIN_VERSION_base(4,5,0)--- (<>) is defined in Data.Monoid-#else-infixr 6 <>---- | An infix synonym for 'mappend'.-(<>) :: Monoid m => m -> m -> m-(<>) = mappend-{-# INLINE (<>) #-}-#endif+import Data.Semigroup (Semigroup(..)) newtype Many a = Many { unMany :: Seq a } deriving (Data, Ord, Eq, Typeable, Foldable, Traversable, Functor, Show, Read)@@ -316,8 +305,7 @@ text :: String -> Inlines text = fromList . map conv . breakBySpaces where breakBySpaces = groupBy sameCategory- sameCategory x y = (is_space x && is_space y) ||- (not $ is_space x || is_space y)+ sameCategory x y = is_space x == is_space y conv xs | all is_space xs = if any is_newline xs then SoftBreak@@ -498,7 +486,7 @@ simpleTable headers rows = table mempty (replicate numcols defaults) headers rows where defaults = (AlignDefault, 0)- numcols = case (headers:rows) of+ numcols = case headers:rows of [] -> 0 xs -> maximum (map length xs)
Text/Pandoc/Definition.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE OverloadedStrings, DeriveDataTypeable, DeriveGeneric,-FlexibleContexts, GeneralizedNewtypeDeriving, PatternGuards, CPP #-}+ FlexibleContexts, GeneralizedNewtypeDeriving, PatternGuards, CPP #-} {--Copyright (c) 2006-2016, John MacFarlane+Copyright (c) 2006-2019, John MacFarlane All rights reserved. @@ -36,7 +36,7 @@ {- | Module : Text.Pandoc.Definition- Copyright : Copyright (C) 2006-2016 John MacFarlane+ Copyright : Copyright (C) 2006-2019 John MacFarlane License : BSD3 Maintainer : John MacFarlane <jgm@berkeley.edu>@@ -81,17 +81,10 @@ import GHC.Generics (Generic) import Data.String import Data.Char (toLower)-#if MIN_VERSION_base(4,8,0) import Control.DeepSeq-#else-import Data.Monoid (Monoid (mappend, mempty))-import Control.Applicative ((<$>), (<*>))-import Control.DeepSeq (NFData(..))-import Control.DeepSeq.Generics-#endif import Paths_pandoc_types (version) import Data.Version (Version, versionBranch)-import Data.Semigroup+import Data.Semigroup (Semigroup(..)) data Pandoc = Pandoc Meta [Block] deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)@@ -112,7 +105,7 @@ -- note: M.union is left-biased, so if there are fields in both m1 -- and m2, m1 wins. instance Monoid Meta where- mempty = Meta (M.empty)+ mempty = Meta M.empty mappend = (<>) data MetaValue = MetaMap (M.Map String MetaValue)@@ -174,7 +167,8 @@ | AlignCenter | AlignDefault deriving (Eq, Ord, Show, Read, Typeable, Data, Generic) --- | List attributes.+-- | List attributes. The first element of the triple is the+-- start number of the list. type ListAttributes = (Int, ListNumberStyle, ListNumberDelim) -- | Style of list numbers.@@ -292,10 +286,10 @@ -- ToJSON/FromJSON instances. We do this by hand instead of deriving -- from generics, so we can have more control over the format. -taggedNoContent :: [Char] -> Value+taggedNoContent :: String -> Value taggedNoContent x = object [ "t" .= x ] -tagged :: ToJSON a => [Char] -> a -> Value+tagged :: ToJSON a => String -> a -> Value tagged x y = object [ "t" .= x, "c" .= y ] instance FromJSON MetaValue where@@ -529,12 +523,12 @@ "DefinitionList" -> DefinitionList <$> v .: "c" "Header" -> do (n, attr, ils) <- v .: "c" return $ Header n attr ils- "HorizontalRule" -> return $ HorizontalRule+ "HorizontalRule" -> return HorizontalRule "Table" -> do (cpt, align, wdths, hdr, rows) <- v .: "c" return $ Table cpt align wdths hdr rows "Div" -> do (attr, blks) <- v .: "c" return $ Div attr blks- "Null" -> return $ Null+ "Null" -> return Null _ -> mempty parseJSON _ = mempty instance ToJSON Block where@@ -580,7 +574,6 @@ ] -- Instances for deepseq-#if MIN_VERSION_base(4,8,0) instance NFData MetaValue instance NFData Meta instance NFData Citation@@ -594,21 +587,6 @@ instance NFData ListNumberStyle instance NFData Block instance NFData Pandoc-#else-instance NFData MetaValue where rnf = genericRnf-instance NFData Meta where rnf = genericRnf-instance NFData Citation where rnf = genericRnf-instance NFData Alignment where rnf = genericRnf-instance NFData Inline where rnf = genericRnf-instance NFData MathType where rnf = genericRnf-instance NFData Format where rnf = genericRnf-instance NFData CitationMode where rnf = genericRnf-instance NFData QuoteType where rnf = genericRnf-instance NFData ListNumberDelim where rnf = genericRnf-instance NFData ListNumberStyle where rnf = genericRnf-instance NFData Block where rnf = genericRnf-instance NFData Pandoc where rnf = genericRnf-#endif pandocTypesVersion :: Version pandocTypesVersion = version
Text/Pandoc/Generic.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} {--Copyright (c) 2006-2016, John MacFarlane+Copyright (c) 2006-2019, John MacFarlane All rights reserved. @@ -34,7 +34,7 @@ {- | Module : Text.Pandoc.Generic- Copyright : Copyright (C) 2006-2010 John MacFarlane+ Copyright : Copyright (C) 2006-2019 John MacFarlane License : BSD3 Maintainer : John MacFarlane <jgm@berkeley.edu>@@ -120,10 +120,6 @@ module Text.Pandoc.Generic where import Data.Generics-#if MIN_VERSION_base(4,8,0)-#else-import Data.Monoid-#endif -- | Applies a transformation on @a@s to matching elements in a @b@, -- moving from the bottom of the structure up.
Text/Pandoc/JSON.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE FlexibleInstances, FlexibleContexts #-} {--Copyright (c) 2013-2016, John MacFarlane+Copyright (c) 2013-2019, John MacFarlane All rights reserved. @@ -34,7 +34,7 @@ {- | Module : Text.Pandoc.JSON- Copyright : Copyright (C) 2013-2016 John MacFarlane+ Copyright : Copyright (C) 2013-2019 John MacFarlane License : BSD3 Maintainer : John MacFarlane <jgm@berkeley.edu>
Text/Pandoc/Walk.hs view
@@ -6,14 +6,9 @@ #if MIN_VERSION_base(4,9,0) {-# OPTIONS_GHC -fno-warn-redundant-constraints -O2 #-} #endif-#if MIN_VERSION_base(4,8,0) #define OVERLAPS {-# OVERLAPPING #-}-#else-{-# LANGUAGE OverlappingInstances #-}-#define OVERLAPS-#endif {--Copyright (c) 2013-2017, John MacFarlane+Copyright (c) 2013-2019, John MacFarlane All rights reserved. @@ -47,7 +42,7 @@ {- | Module : Text.Pandoc.Walk- Copyright : Copyright (C) 2013 John MacFarlane+ Copyright : Copyright (C) 2013-2019 John MacFarlane License : BSD3 Maintainer : John MacFarlane <jgm@berkeley.edu>@@ -91,7 +86,19 @@ -} -module Text.Pandoc.Walk (Walkable(..))+module Text.Pandoc.Walk+ ( Walkable(..)+ , queryBlock+ , queryCitation+ , queryInline+ , queryMetaValue+ , queryPandoc+ , walkBlockM+ , walkCitationM+ , walkInlineM+ , walkMetaValueM+ , walkPandocM+ ) where import Control.Applicative (Applicative ((<*>), pure), (<$>)) import Control.Monad ((>=>))@@ -101,11 +108,7 @@ import Data.Traversable (Traversable) import qualified Data.Foldable as F import Data.Foldable (Foldable)-#if MIN_VERSION_base(4,8,0) import Data.Monoid ((<>))-#else-import Data.Monoid-#endif class Walkable a b where -- | @walk f x@ walks the structure @x@ (bottom up) and replaces every@@ -124,6 +127,7 @@ walkM f = T.mapM (walkM f) query f = F.foldMap (query f) +-- Walk pairs by handling both elements, then combine the results. instance OVERLAPS (Walkable a b, Walkable a c) => Walkable a (b,c) where walk f (x,y) = (walk f x, walk f y)@@ -142,24 +146,24 @@ query f inlns = f inlns <> mconcat (map (queryInline f) inlns) instance Walkable [Inline] Inline where- walkM f = walkInlineM f- query f = queryInline f+ walkM = walkInlineM+ query = queryInline instance Walkable Inline Block where- walkM f = walkBlockM f- query f = queryBlock f+ walkM = walkBlockM+ query = queryBlock instance Walkable [Inline] Block where- walkM f = walkBlockM f- query f = queryBlock f+ walkM = walkBlockM+ query = queryBlock instance Walkable Block Block where walkM f x = walkBlockM f x >>= f query f x = f x <> queryBlock f x instance Walkable [Block] Block where- walkM f = walkBlockM f- query f = queryBlock f+ walkM = walkBlockM+ query = queryBlock instance OVERLAPS Walkable [Block] [Block] where@@ -167,13 +171,16 @@ query f blks = f blks <> mconcat (map (queryBlock f) blks) instance Walkable Block Inline where- walkM f = walkInlineM f- query f = queryInline f+ walkM = walkInlineM+ query = queryInline instance Walkable [Block] Inline where- walkM f = walkInlineM f- query f = queryInline f+ walkM = walkInlineM+ query = queryInline +--+-- Walk Pandoc+-- instance Walkable Block Pandoc where walkM = walkPandocM query = queryPandoc@@ -194,6 +201,9 @@ walkM f = f query f = f +--+-- Walk Meta+-- instance Walkable Meta Meta where walkM f = f query f = f@@ -214,6 +224,9 @@ walkM f (Meta metamap) = Meta <$> walkM f metamap query f (Meta metamap) = query f metamap +--+-- Walk MetaValue+-- instance Walkable Inline MetaValue where walkM = walkMetaValueM query = queryMetaValue@@ -230,6 +243,9 @@ walkM = walkMetaValueM query = queryMetaValue +--+-- Walk Citation+-- instance Walkable Inline Citation where walkM = walkCitationM query = queryCitation@@ -246,6 +262,11 @@ walkM = walkCitationM query = queryCitation +-- | Helper method to walk to elements nested below @'Inline'@ nodes.+--+-- When walking an inline with this function, only the contents of the traversed+-- inline element may change. The element itself, i.e. its constructor, cannot+-- be changed. walkInlineM :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Inline -> m Inline@@ -269,37 +290,8 @@ walkInlineM _ x@Math {} = return x walkInlineM _ x@RawInline {} = return x -walkBlockM :: (Walkable a [Block], Walkable a [Inline], Monad m,- Applicative m, Functor m)- => (a -> m a) -> Block -> m Block-walkBlockM f (Para xs) = Para <$> walkM f xs-walkBlockM f (Plain xs) = Plain <$> walkM f xs-walkBlockM f (LineBlock xs) = LineBlock <$> walkM f xs-walkBlockM f (BlockQuote xs) = BlockQuote <$> walkM f xs-walkBlockM f (OrderedList a cs) = OrderedList a <$> walkM f cs-walkBlockM f (BulletList cs) = BulletList <$> walkM f cs-walkBlockM f (DefinitionList xs) = DefinitionList <$> walkM f xs-walkBlockM f (Header lev attr xs) = Header lev attr <$> walkM f xs-walkBlockM f (Div attr bs') = Div attr <$> walkM f bs'-walkBlockM _ x@CodeBlock {} = return x-walkBlockM _ x@RawBlock {} = return x-walkBlockM _ HorizontalRule = return HorizontalRule-walkBlockM _ Null = return Null-walkBlockM f (Table capt as ws hs rs) = do capt' <- walkM f capt- hs' <- walkM f hs- rs' <- walkM f rs- return $ Table capt' as ws hs' rs'--walkMetaValueM :: (Walkable a MetaValue, Walkable a [Block],- Walkable a [Inline], Monad f, Applicative f, Functor f)- => (a -> f a) -> MetaValue -> f MetaValue-walkMetaValueM f (MetaList xs) = MetaList <$> walkM f xs-walkMetaValueM _ (MetaBool b) = return $ MetaBool b-walkMetaValueM _ (MetaString s) = return $ MetaString s-walkMetaValueM f (MetaInlines xs) = MetaInlines <$> walkM f xs-walkMetaValueM f (MetaBlocks bs) = MetaBlocks <$> walkM f bs-walkMetaValueM f (MetaMap m) = MetaMap <$> walkM f m-+-- | Perform a query on elements nested below an @'Inline'@ element by+-- querying nested lists of @Inline@s, @Block@s, or @Citation@s. queryInline :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> Inline -> c@@ -323,6 +315,35 @@ queryInline f (Note bs) = query f bs queryInline f (Span _ xs) = query f xs ++-- | Helper method to walk to elements nested below @'Block'@ nodes.+--+-- When walking a block with this function, only the contents of the traversed+-- block element may change. The element itself, i.e. its constructor, its @'Attr'@,+-- and its raw text value, will remain unchanged.+walkBlockM :: (Walkable a [Block], Walkable a [Inline], Monad m,+ Applicative m, Functor m)+ => (a -> m a) -> Block -> m Block+walkBlockM f (Para xs) = Para <$> walkM f xs+walkBlockM f (Plain xs) = Plain <$> walkM f xs+walkBlockM f (LineBlock xs) = LineBlock <$> walkM f xs+walkBlockM f (BlockQuote xs) = BlockQuote <$> walkM f xs+walkBlockM f (OrderedList a cs) = OrderedList a <$> walkM f cs+walkBlockM f (BulletList cs) = BulletList <$> walkM f cs+walkBlockM f (DefinitionList xs) = DefinitionList <$> walkM f xs+walkBlockM f (Header lev attr xs) = Header lev attr <$> walkM f xs+walkBlockM f (Div attr bs') = Div attr <$> walkM f bs'+walkBlockM _ x@CodeBlock {} = return x+walkBlockM _ x@RawBlock {} = return x+walkBlockM _ HorizontalRule = return HorizontalRule+walkBlockM _ Null = return Null+walkBlockM f (Table capt as ws hs rs) = do capt' <- walkM f capt+ hs' <- walkM f hs+ rs' <- walkM f rs+ return $ Table capt' as ws hs' rs'++-- | Perform a query on elements nested below a @'Block'@ element by+-- querying all directly nested lists of @Inline@s or @Block@s. queryBlock :: (Walkable a Citation, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> Block -> c@@ -341,6 +362,24 @@ queryBlock f (Div _ bs) = query f bs queryBlock _ Null = mempty +-- | Helper method to walk to elements nested below @'MetaValue'@ nodes.+--+-- When walking a meta value with this function, only the contents of the+-- traversed meta value element may change. @MetaBool@ and @MetaString@ will+-- always remain unchanged.+walkMetaValueM :: (Walkable a MetaValue, Walkable a [Block],+ Walkable a [Inline], Monad f, Applicative f, Functor f)+ => (a -> f a) -> MetaValue -> f MetaValue+walkMetaValueM f (MetaList xs) = MetaList <$> walkM f xs+walkMetaValueM _ (MetaBool b) = return $ MetaBool b+walkMetaValueM _ (MetaString s) = return $ MetaString s+walkMetaValueM f (MetaInlines xs) = MetaInlines <$> walkM f xs+walkMetaValueM f (MetaBlocks bs) = MetaBlocks <$> walkM f bs+walkMetaValueM f (MetaMap m) = MetaMap <$> walkM f m++-- | Perform a query on elements nested below a @'MetaValue'@ element by+-- querying all directly nested lists of @Inline@s, list of @Block@s, or+-- lists or maps of @MetaValue@s. queryMetaValue :: (Walkable a MetaValue, Walkable a [Block], Walkable a [Inline], Monoid c) => (a -> c) -> MetaValue -> c@@ -351,6 +390,11 @@ queryMetaValue f (MetaBlocks bs) = query f bs queryMetaValue f (MetaMap m) = query f m +-- | Helper method to walk to elements nested below @'Citation'@ nodes.+--+-- The non-inline contents of a citation will remain unchanged during traversal.+-- Only the inline contents, viz. the citation's prefix and postfix, will be+-- traversed further and can thus be changed during this operation. walkCitationM :: (Walkable a [Inline], Monad m, Applicative m, Functor m) => (a -> m a) -> Citation -> m Citation walkCitationM f (Citation id' pref suff mode notenum hash) =@@ -358,10 +402,13 @@ suff' <- walkM f suff return $ Citation id' pref' suff' mode notenum hash +-- | Perform a query on elements nested below a @'Citation'@ element by+-- querying the prefix and postfix @Inline@ lists. queryCitation :: (Walkable a [Inline], Monoid c) => (a -> c) -> Citation -> c queryCitation f (Citation _ pref suff _ _ _) = query f pref <> query f suff +-- | Helper method to walk the components of a Pandoc element. walkPandocM :: (Walkable a Meta, Walkable a [Block], Monad m, Applicative m, Functor m) => (a -> m a) -> Pandoc -> m Pandoc@@ -369,6 +416,8 @@ bs' <- walkM f bs return $ Pandoc m' bs' +-- | Query a pandoc element by recursing first into its @'Meta'@ data+-- and then append the result of recursing into the list of @'Block'@s. queryPandoc :: (Walkable a Meta, Walkable a [Block], Monoid c) => (a -> c) -> Pandoc -> c queryPandoc f (Pandoc m bs) = query f m <> query f bs
benchmark/bench.hs view
@@ -6,7 +6,7 @@ import Text.Pandoc.Builder main :: IO ()-main = do+main = defaultMain [ bench "simple walk" $ nf (walk prependZeroWidthSpace) mydoc , bench "walk concatMap" $ nf (walk $ concatMap prependZeroWidthSpace') mydoc@@ -23,7 +23,7 @@ prependZeroWidthSpace'' :: [Inline] -> [Inline] prependZeroWidthSpace'' (Str s : xs) =- (Str ('\8203' : s) : prependZeroWidthSpace'' xs)+ Str ('\8203' : s) : prependZeroWidthSpace'' xs prependZeroWidthSpace'' (x : xs) = x : prependZeroWidthSpace'' xs prependZeroWidthSpace'' [] = []
changelog view
@@ -1,3 +1,15 @@+[1.17.6]++ * Walk: export walk and query helpers (Albert Krewinkel) [API change].+ The `walk*M` and `query*` functions are helpful when defining new+ `Walkable` instances.+ * Allow QuickCheck 2.13.+ * Document meaning of Int in ListAttributes (#45).+ * Update copyright year spans to include 2019 (Albert Krewinkel).+ * Remove CPP instructions for GHC versions < 7.10 (Albert Krewinkel).+ * update list of GHC versions used for testing (Albert Krewinkel).+ * Fix compiler and hlint warnings (Pete Ryland).+ [1.17.5.4] * Put NFData in scope for ghc < 7.10.
pandoc-types.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-types-Version: 1.17.5.4+Version: 1.17.6 Synopsis: Types for representing a structured document Description: @Text.Pandoc.Definition@ defines the 'Pandoc' data structure, which is used by pandoc to represent@@ -22,17 +22,18 @@ @Text.Pandoc.JSON@ provides functions for serializing and deserializing a @Pandoc@ structure to and from JSON. -Homepage: http://johnmacfarlane.net/pandoc+Homepage: https://pandoc.org/ License: BSD3 License-file: LICENSE Author: John MacFarlane Maintainer: jgm@berkeley.edu Bug-Reports: https://github.com/jgm/pandoc-types/issues-Copyright: (c) 2006-2017 John MacFarlane+Copyright: (c) 2006-2019 John MacFarlane Category: Text Build-type: Simple Cabal-version: >=1.8-Tested-With: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+Tested-With: GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.2, GHC == 8.4.2,+ GHC == 8.6.5 Extra-Source-Files: changelog Source-repository head type: git@@ -48,19 +49,15 @@ Other-modules: Paths_pandoc_types Build-depends: base >= 4.5 && < 5, containers >= 0.3,+ deepseq >= 1.4.1 && < 1.5, syb >= 0.1 && < 0.8, ghc-prim >= 0.2, bytestring >= 0.9 && < 0.11, aeson >= 0.6.2 && < 1.5, transformers >= 0.2 && < 0.6,- QuickCheck >= 2.4 && < 2.13+ QuickCheck >= 2.4 && < 2.14 if !impl(ghc >= 8.0) Build-depends: semigroups == 0.18.*- if impl(ghc < 7.10)- Build-depends: deepseq-generics >= 0.2 && < 0.3,- deepseq >= 1.3 && < 1.5- else- Build-depends: deepseq >= 1.4.1 && < 1.5 ghc-options: -Wall test-suite test-pandoc-types@@ -76,7 +73,7 @@ test-framework >= 0.3 && < 0.9, test-framework-hunit >= 0.2 && < 0.4, test-framework-quickcheck2 >= 0.2.9 && < 0.4,- QuickCheck >= 2.4 && < 2.13,+ QuickCheck >= 2.4 && < 2.14, HUnit >= 1.2 && < 1.7, string-qq == 0.0.2 ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -O2
test/test-pandoc-types.hs view
@@ -15,10 +15,6 @@ import qualified Data.Map as M import Data.String.QQ import Data.ByteString.Lazy (ByteString)-#if MIN_VERSION_base(4,8,0)-#else-import Data.Monoid-#endif import qualified Data.Monoid as Monoid @@ -367,7 +363,7 @@ -- cells in order to avoid syntax errors after conversion, see -- jgm/pandoc#4059. t_tableSan :: Test-t_tableSan = testCase "table sanitisation" $ assertion+t_tableSan = testCase "table sanitisation" assertion where assertion = assertEqual err expected generated err = "sanitisation error" generated = simpleTable