pandoc-types 1.17.0.5 → 1.17.1
raw patch · 6 files changed
+41/−14 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Text/Pandoc/Arbitrary.hs +6/−0
- Text/Pandoc/Builder.hs +12/−6
- Text/Pandoc/Walk.hs +1/−1
- changelog +10/−0
- pandoc-types.cabal +6/−6
- test/test-pandoc-types.hs +6/−1
Text/Pandoc/Arbitrary.hs view
@@ -48,6 +48,9 @@ , (10, liftM Superscript $ arbInlines (n-1)) , (10, liftM Subscript $ arbInlines (n-1)) , (10, liftM SmallCaps $ arbInlines (n-1))+ , (10, do x1 <- arbAttr+ x2 <- arbInlines (n-1)+ return $ Span x1 x2) , (10, do x1 <- arbitrary x2 <- arbInlines (n-1) return $ Quoted x1 x2)@@ -102,6 +105,9 @@ x2 <- arbInlines (n-1) return (x2,x1) return $ DefinitionList items)+ , (5, do x1 <- arbAttr+ x2 <- listOf1 $ arbBlock (n-1)+ return $ Div x1 x2) , (2, do rs <- choose (1 :: Int, 4) cs <- choose (1 :: Int, 4) x1 <- arbInlines (n-1)
Text/Pandoc/Builder.hs view
@@ -478,19 +478,25 @@ -> Blocks table caption cellspecs headers rows = singleton $ Table (toList caption) aligns widths- (map toList headers) (map (map toList) rows)+ (map toList headers') (map (map toList) rows) where (aligns, widths) = unzip cellspecs+ numcols = case (headers:rows) of+ [] -> 0+ xs -> maximum (map length xs)+ headers' = if null headers+ then replicate numcols mempty+ else headers -- | A simple table without a caption. simpleTable :: [Blocks] -- ^ Headers -> [[Blocks]] -- ^ Rows -> Blocks-simpleTable headers = table mempty (mapConst defaults headers) headers+simpleTable headers rows =+ table mempty (replicate numcols defaults) headers rows where defaults = (AlignDefault, 0)+ numcols = case (headers:rows) of+ [] -> 0+ xs -> maximum (map length xs) divWith :: Attr -> Blocks -> Blocks divWith attr = singleton . Div attr . toList--mapConst :: Functor f => b -> f a -> f b-mapConst = fmap . const-
Text/Pandoc/Walk.hs view
@@ -91,12 +91,12 @@ where import Control.Applicative ((<$>)) import Text.Pandoc.Definition-import Text.Pandoc.Builder ((<>)) import qualified Data.Traversable as T 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
changelog view
@@ -1,3 +1,13 @@+[1.17.1]++ * Better consistency in simpleTable and table (jgm/pandoc#3648).+ If `headers` is empty, we populate it with empty cells, using the rows+ to determine number of columns. We also ensure that there are numcols+ alignments and column widths.+ * Make sure Div and Span occur in Arbitrary instances.+ * Bump dependency upper bounds.+ * Removed unused mapConst.+ [1.17.0.5] * Allow aeson 1.1.
pandoc-types.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-types-Version: 1.17.0.5+Version: 1.17.1 Synopsis: Types for representing a structured document Description: @Text.Pandoc.Definition@ defines the 'Pandoc' data structure, which is used by pandoc to represent@@ -48,10 +48,10 @@ Other-modules: Paths_pandoc_types Build-depends: base >= 4 && < 5, containers >= 0.3,- syb >= 0.1 && < 0.7,+ syb >= 0.1 && < 0.8, ghc-prim >= 0.2, bytestring >= 0.9 && < 0.11,- aeson >= 0.6.2 && < 1.2,+ aeson >= 0.6.2 && < 1.3, QuickCheck >= 2 if impl(ghc < 7.10) Build-depends: deepseq-generics >= 0.1 && < 0.2@@ -65,13 +65,13 @@ build-depends: base, pandoc-types, syb,- aeson >= 0.6.2 && < 1.2,+ aeson >= 0.6.2 && < 1.3, containers >= 0.3, bytestring >= 0.9 && < 0.11, 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.10,- HUnit >= 1.2 && < 1.6,+ QuickCheck >= 2.4 && < 2.11,+ HUnit >= 1.2 && < 1.7, string-qq == 0.0.2 ghc-options: -threaded -rtsopts -with-rtsopts=-N
test/test-pandoc-types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, QuasiQuotes, FlexibleContexts #-}+{-# LANGUAGE OverloadedStrings, QuasiQuotes, FlexibleContexts, CPP #-} import Text.Pandoc.Definition import Text.Pandoc.Walk@@ -14,6 +14,11 @@ 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+ p_walk :: (Typeable a, Walkable a Pandoc) => (a -> a) -> Pandoc -> Bool