Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-pandoc-types for 
openSUSE:Factory checked in at 2021-11-11 21:36:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-pandoc-types (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-pandoc-types.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-pandoc-types"

Thu Nov 11 21:36:43 2021 rev:34 rq:930345 version:1.22.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-pandoc-types/ghc-pandoc-types.changes        
2021-10-12 21:50:33.343974999 +0200
+++ 
/work/SRC/openSUSE:Factory/.ghc-pandoc-types.new.1890/ghc-pandoc-types.changes  
    2021-11-11 21:37:01.564915086 +0100
@@ -1,0 +2,23 @@
+Mon Nov  1 08:29:45 UTC 2021 - [email protected]
+
+- Update pandoc-types to version 1.22.1.
+  [1.22.1]
+
+    * Text.Pandoc.Builder: add simpleFigure, simpleFigureWith,
+      and the SimpleFigure bidirectional pattern synonym
+      (Aner Lucero) [API change].
+
+    * Allow bytestring 0.11 (Alexander Batischev).
+
+    * Update stack resolver to lts-18.10
+
+    * Allow aeson 2+.  Tested with aeson 2.0.1.0.
+
+    * Allow transformers 0.6.
+
+    * Fix incorrect table ColWidth documentation (#85, Nils Carlson).
+      The documentation stated that the ColWidth represented the width
+      of the column as a fraction of the table width when in represents
+      a percentage of the text width.
+
+-------------------------------------------------------------------

Old:
----
  pandoc-types-1.22.tar.gz
  pandoc-types.cabal

New:
----
  pandoc-types-1.22.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-pandoc-types.spec ++++++
--- /var/tmp/diff_new_pack.DVd7dx/_old  2021-11-11 21:37:02.088915468 +0100
+++ /var/tmp/diff_new_pack.DVd7dx/_new  2021-11-11 21:37:02.088915468 +0100
@@ -19,13 +19,12 @@
 %global pkg_name pandoc-types
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.22
+Version:        1.22.1
 Release:        0
 Summary:        Types for representing a structured document
 License:        GPL-2.0-only
 URL:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Source1:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
 BuildRequires:  ghc-Cabal-devel
 BuildRequires:  ghc-QuickCheck-devel
 BuildRequires:  ghc-aeson-devel
@@ -76,7 +75,6 @@
 
 %prep
 %autosetup -n %{pkg_name}-%{version}
-cp -p %{SOURCE1} %{pkg_name}.cabal
 
 %build
 %ghc_lib_build

++++++ pandoc-types-1.22.tar.gz -> pandoc-types-1.22.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-types-1.22/changelog 
new/pandoc-types-1.22.1/changelog
--- old/pandoc-types-1.22/changelog     2020-09-19 18:46:56.000000000 +0200
+++ new/pandoc-types-1.22.1/changelog   2021-10-22 23:09:19.000000000 +0200
@@ -1,3 +1,22 @@
+[1.22.1]
+
+  * Text.Pandoc.Builder: add simpleFigure, simpleFigureWith,
+    and the SimpleFigure bidirectional pattern synonym
+    (Aner Lucero) [API change].
+
+  * Allow bytestring 0.11 (Alexander Batischev).
+
+  * Update stack resolver to lts-18.10
+
+  * Allow aeson 2+.  Tested with aeson 2.0.1.0.
+
+  * Allow transformers 0.6.
+
+  * Fix incorrect table ColWidth documentation (#85, Nils Carlson).
+    The documentation stated that the ColWidth represented the width
+    of the column as a fraction of the table width when in represents
+    a percentage of the text width.
+
 [1.22]
 
   * Deprecate isNull from Builder:  null can serve just as well (#67).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-types-1.22/pandoc-types.cabal 
new/pandoc-types-1.22.1/pandoc-types.cabal
--- old/pandoc-types-1.22/pandoc-types.cabal    2020-09-18 18:08:57.000000000 
+0200
+++ new/pandoc-types-1.22.1/pandoc-types.cabal  2021-10-22 22:50:10.000000000 
+0200
@@ -1,6 +1,6 @@
 cabal-version:       2.2
 Name:                pandoc-types
-version:             1.22
+version:             1.22.1
 Synopsis:            Types for representing a structured document
 Description:         @Text.Pandoc.Definition@ defines the 'Pandoc' data
                      structure, which is used by pandoc to represent
@@ -55,9 +55,9 @@
                      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.6,
-                     transformers >= 0.2 && < 0.6,
+                     bytestring >= 0.9 && < 0.12,
+                     aeson >= 0.6.2 && < 2.1,
+                     transformers >= 0.2 && < 0.7,
                      QuickCheck >= 2.10 && < 2.15
   if !impl(ghc >= 8.0)
     Build-depends:   semigroups == 0.18.*
@@ -71,10 +71,10 @@
   build-depends:       base,
                        pandoc-types,
                        syb,
-                       aeson >= 0.6.2 && < 1.6,
+                       aeson >= 0.6.2 && < 2.1,
                        containers >= 0.3,
                        text,
-                       bytestring >= 0.9 && < 0.11,
+                       bytestring >= 0.9 && < 0.12,
                        test-framework >= 0.3 && < 0.9,
                        test-framework-hunit >= 0.2 && < 0.4,
                        test-framework-quickcheck2 >= 0.2.9 && < 0.4,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-types-1.22/src/Text/Pandoc/Builder.hs 
new/pandoc-types-1.22.1/src/Text/Pandoc/Builder.hs
--- old/pandoc-types-1.22/src/Text/Pandoc/Builder.hs    2020-09-18 
17:58:50.000000000 +0200
+++ new/pandoc-types-1.22.1/src/Text/Pandoc/Builder.hs  2021-10-01 
23:26:40.000000000 +0200
@@ -1,6 +1,7 @@
 {-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable,
     GeneralizedNewtypeDeriving, CPP, StandaloneDeriving, DeriveGeneric,
     DeriveTraversable, OverloadedStrings, PatternGuards #-}
+
 {-
 Copyright (C) 2010-2019 John MacFarlane
 
@@ -170,6 +171,8 @@
                            , caption
                            , simpleCaption
                            , emptyCaption
+                           , simpleFigureWith
+                           , simpleFigure
                            , divWith
                            -- * Table processing
                            , normalizeTableHead
@@ -566,6 +569,13 @@
 emptyCaption :: Caption
 emptyCaption = simpleCaption mempty
 
+simpleFigureWith :: Attr -> Inlines -> Text -> Text -> Blocks
+simpleFigureWith attr figureCaption url title =
+  para $ imageWith attr url ("fig:" <> title) figureCaption
+
+simpleFigure :: Inlines -> Text -> Text -> Blocks
+simpleFigure = simpleFigureWith nullAttr
+
 divWith :: Attr -> Blocks -> Blocks
 divWith attr = singleton . Div attr . toList
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-types-1.22/src/Text/Pandoc/Definition.hs 
new/pandoc-types-1.22.1/src/Text/Pandoc/Definition.hs
--- old/pandoc-types-1.22/src/Text/Pandoc/Definition.hs 2020-09-18 
17:55:50.000000000 +0200
+++ new/pandoc-types-1.22.1/src/Text/Pandoc/Definition.hs       2021-10-22 
22:13:17.000000000 +0200
@@ -1,6 +1,6 @@
 {-# LANGUAGE OverloadedStrings, DeriveDataTypeable, DeriveGeneric,
     FlexibleContexts, GeneralizedNewtypeDeriving, PatternGuards, CPP,
-    TemplateHaskell #-}
+    TemplateHaskell , PatternSynonyms, ViewPatterns #-}
 
 {-
 Copyright (c) 2006-2019, John MacFarlane
@@ -57,6 +57,7 @@
                               , docAuthors
                               , docDate
                               , Block(..)
+                              , pattern SimpleFigure
                               , Inline(..)
                               , ListAttributes
                               , ListNumberStyle(..)
@@ -99,6 +100,7 @@
 import Paths_pandoc_types (version)
 import Data.Version (Version, versionBranch)
 import Data.Semigroup (Semigroup(..))
+import Control.Arrow (second)
 
 data Pandoc = Pandoc Meta [Block]
               deriving (Eq, Ord, Read, Show, Typeable, Data, Generic)
@@ -224,8 +226,7 @@
                | AlignCenter
                | AlignDefault deriving (Eq, Ord, Show, Read, Typeable, Data, 
Generic)
 
--- | The width of a table column, as a fraction of the total table
--- width.
+-- | The width of a table column, as a percentage of the text width.
 data ColWidth = ColWidth Double
               | ColWidthDefault deriving (Eq, Ord, Show, Read, Typeable, Data, 
Generic)
 
@@ -312,6 +313,34 @@
 -- | Link target (URL, title).
 type Target = (Text, Text)
 
+isFigureTarget :: Target -> Maybe Target
+isFigureTarget tgt
+  | (src, Just tit) <- second (T.stripPrefix "fig:") tgt = Just (src, tit)
+  | otherwise = Nothing
+
+-- | Bidirectional patter synonym
+--
+-- It can pass as a Block constructor
+--
+-- >>> SimpleFigure nullAttr [] (T.pack "", T.pack "title")
+-- Para [Image ("",[],[]) [] ("","fig:title")]
+--
+--
+-- It can be used to pattern match
+-- >>> let img = Para [Image undefined undefined (undefined, T.pack "title")]
+-- >>> case img of { SimpleFigure _ _ _ -> True; _ -> False }
+-- False
+-- >>> let fig = Para [Image undefined undefined (undefined, T.pack 
"fig:title")]
+-- >>> case fig of { SimpleFigure _ _ tit -> snd tit; _ -> T.pack "" }
+-- "title"
+pattern SimpleFigure :: Attr -> [Inline] -> Target -> Block
+pattern SimpleFigure attr figureCaption tgt <-
+    Para [Image attr figureCaption
+        (isFigureTarget -> Just tgt)]  where
+  SimpleFigure attr figureCaption tgt =
+    Para [Image attr figureCaption (second ("fig:" <>) tgt)]
+
+
 -- | Type of math element (display or inline).
 data MathType = DisplayMath | InlineMath deriving (Show, Eq, Ord, Read, 
Typeable, Data, Generic)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-types-1.22/test/test-pandoc-types.hs 
new/pandoc-types-1.22.1/test/test-pandoc-types.hs
--- old/pandoc-types-1.22/test/test-pandoc-types.hs     2020-09-18 
17:55:50.000000000 +0200
+++ new/pandoc-types-1.22.1/test/test-pandoc-types.hs   2021-10-22 
22:13:17.000000000 +0200
@@ -5,7 +5,8 @@
 import Text.Pandoc.Walk
 import Text.Pandoc.Builder (singleton, plain, text, simpleTable, table, 
emptyCell,
                             normalizeTableHead, normalizeTableBody, 
normalizeTableFoot,
-                            emptyCaption)
+                            emptyCaption, simpleFigureWith)
+import qualified Text.Pandoc.Builder as Builder
 import Data.Generics
 import Data.List (tails)
 import Test.HUnit (Assertion, assertEqual, assertFailure)
@@ -13,7 +14,7 @@
 import Test.Framework
 import Test.Framework.Providers.QuickCheck2 (testProperty)
 import Test.Framework.Providers.HUnit (testCase)
-import Test.QuickCheck (forAll, choose, Property, Arbitrary, Testable)
+import Test.QuickCheck (forAll, choose, Property, Arbitrary, Testable, 
arbitrary, Gen)
 import qualified Data.Map as M
 import Data.Text (Text)
 import qualified Data.Text as T
@@ -642,6 +643,17 @@
                                  (tf finalHeads)
     generated = table emptyCaption spec (th initialHeads) [initialTB] (tf 
initialHeads)
 
+p_figureRepresentation :: Property
+p_figureRepresentation = forAll (arbitrary :: Gen [Inline]) (\figureCaption ->
+  simpleFigureWith
+      ("", [], [])
+      (Builder.fromList figureCaption)
+      "url"
+      "title" ==
+      Builder.fromList
+          [Para [Image ("", [], []) figureCaption ("url", "fig:title") ]]
+  )
+
 tests :: [Test]
 tests =
   [ testGroup "Walk"
@@ -744,6 +756,8 @@
     ]
   , t_tableSan
   , t_tableNormExample
+  , testGroup "Figure"
+    [ testProperty "p_figureRepresentation figure representation" 
p_figureRepresentation ]
   ]
 
 

Reply via email to