Hello community,

here is the log from the commit of package ghc-doctemplates for 
openSUSE:Factory checked in at 2020-05-11 13:34:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-doctemplates (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-doctemplates.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-doctemplates"

Mon May 11 13:34:40 2020 rev:8 rq:801012 version:0.8.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-doctemplates/ghc-doctemplates.changes        
2020-03-09 14:16:03.966612685 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-doctemplates.new.2738/ghc-doctemplates.changes  
    2020-05-11 13:35:24.728370268 +0200
@@ -1,0 +2,11 @@
+Wed May  6 06:54:10 UTC 2020 - psim...@suse.com
+
+- Update doctemplates to version 0.8.2.
+  ## 0.8.2
+
+    * Add filters: first, rest, last, allbutlast.
+
+    * New constructors for Filter: FirstItem, LastItem, Rest, AllButLast
+      [API change].
+
+-------------------------------------------------------------------

Old:
----
  doctemplates-0.8.1.tar.gz

New:
----
  doctemplates-0.8.2.tar.gz

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

Other differences:
------------------
++++++ ghc-doctemplates.spec ++++++
--- /var/tmp/diff_new_pack.RACaig/_old  2020-05-11 13:35:25.344371559 +0200
+++ /var/tmp/diff_new_pack.RACaig/_new  2020-05-11 13:35:25.348371568 +0200
@@ -19,7 +19,7 @@
 %global pkg_name doctemplates
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.8.1
+Version:        0.8.2
 Release:        0
 Summary:        Pandoc-style document templates
 License:        BSD-3-Clause

++++++ doctemplates-0.8.1.tar.gz -> doctemplates-0.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/README.md 
new/doctemplates-0.8.2/README.md
--- old/doctemplates-0.8.1/README.md    2019-12-07 20:47:07.000000000 +0100
+++ new/doctemplates-0.8.2/README.md    2020-04-13 03:26:19.000000000 +0200
@@ -397,6 +397,22 @@
   value was an array, the `key` will be the array index,
   starting with 1.
 
+- `first`: Returns the first value of an array, if
+  applied to a non-empty array; otherwise returns
+  the original value.
+
+- `last`: Returns the last value of an array, if
+  applied to a non-empty array; otherwise returns
+  the original value.
+
+- `rest`: Returns all but the first value of an array, if
+  applied to a non-empty array; otherwise returns
+  the original value.
+
+- `allbutlast`: Returns all but the last value of an array, if
+  applied to a non-empty array; otherwise returns
+  the original value.
+
 - `uppercase`:  Converts text to uppercase.
 
 - `lowercase`:  Converts text to lowercase.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/changelog.md 
new/doctemplates-0.8.2/changelog.md
--- old/doctemplates-0.8.1/changelog.md 2020-01-13 08:18:25.000000000 +0100
+++ new/doctemplates-0.8.2/changelog.md 2020-04-13 07:09:37.000000000 +0200
@@ -1,5 +1,12 @@
 # doctemplates
 
+## 0.8.2
+
+  * Add filters: first, rest, last, allbutlast.
+
+  * New constructors for Filter: FirstItem, LastItem, Rest, AllButLast
+    [API change].
+
 ## 0.8.1
 
   * Depend on doclayout 0.3, which adds an additional method
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/doctemplates.cabal 
new/doctemplates-0.8.2/doctemplates.cabal
--- old/doctemplates-0.8.1/doctemplates.cabal   2020-01-13 08:03:14.000000000 
+0100
+++ new/doctemplates-0.8.2/doctemplates.cabal   2020-04-13 06:47:48.000000000 
+0200
@@ -1,5 +1,5 @@
 name:                doctemplates
-version:             0.8.1
+version:             0.8.2
 synopsis:            Pandoc-style document templates
 description:         This is the text templating system used by pandoc.
                      It supports variable interpolation, iteration,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/src/Text/DocTemplates/Internal.hs 
new/doctemplates-0.8.2/src/Text/DocTemplates/Internal.hs
--- old/doctemplates-0.8.1/src/Text/DocTemplates/Internal.hs    2019-12-23 
06:53:31.000000000 +0100
+++ new/doctemplates-0.8.2/src/Text/DocTemplates/Internal.hs    2020-04-13 
07:06:54.000000000 +0200
@@ -92,6 +92,10 @@
     | ToLowercase
     | ToLength
     | Reverse
+    | FirstItem
+    | LastItem
+    | Rest
+    | AllButLast
     | Chomp
     | ToAlpha
     | ToRoman
@@ -315,6 +319,22 @@
   toPair (k, v) = MapVal $ Context $ M.fromList
                     [ ("key", SimpleVal $ fromString . T.unpack $ k)
                     , ("value", v) ]
+applyPipe FirstItem val =
+  case val of
+    ListVal (x:_) -> x
+    _             -> val
+applyPipe LastItem val =
+  case val of
+    ListVal xs@(_:_) -> last xs
+    _                -> val
+applyPipe Rest val =
+  case val of
+    ListVal (_:xs) -> ListVal xs
+    _              -> val
+applyPipe AllButLast val =
+  case val of
+    ListVal xs@(_:_) -> ListVal (init xs)
+    _                -> val
 applyPipe Reverse val =
   case val of
     ListVal xs  -> ListVal (reverse xs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/src/Text/DocTemplates/Parser.hs 
new/doctemplates-0.8.2/src/Text/DocTemplates/Parser.hs
--- old/doctemplates-0.8.1/src/Text/DocTemplates/Parser.hs      2019-12-07 
20:48:55.000000000 +0100
+++ new/doctemplates-0.8.2/src/Text/DocTemplates/Parser.hs      2020-04-13 
07:07:07.000000000 +0200
@@ -408,19 +408,23 @@
   pipeName <- P.many1 P.letter
   P.notFollowedBy P.letter
   case pipeName of
-    "uppercase" -> return ToUppercase
-    "lowercase" -> return ToLowercase
-    "pairs"     -> return ToPairs
-    "length"    -> return ToLength
-    "alpha"     -> return ToAlpha
-    "roman"     -> return ToRoman
-    "reverse"   -> return Reverse
-    "chomp"     -> return Chomp
-    "nowrap"    -> return NoWrap
-    "left"      -> Block LeftAligned <$> pBlockWidth <*> pBlockBorders
-    "right"     -> Block RightAligned <$> pBlockWidth <*> pBlockBorders
-    "center"    -> Block Centered <$> pBlockWidth <*> pBlockBorders
-    _           -> fail $ "Unknown pipe " ++ pipeName
+    "uppercase"  -> return ToUppercase
+    "lowercase"  -> return ToLowercase
+    "pairs"      -> return ToPairs
+    "length"     -> return ToLength
+    "alpha"      -> return ToAlpha
+    "roman"      -> return ToRoman
+    "reverse"    -> return Reverse
+    "first"      -> return FirstItem
+    "rest"       -> return Rest
+    "last"       -> return LastItem
+    "allbutlast" -> return AllButLast
+    "chomp"      -> return Chomp
+    "nowrap"     -> return NoWrap
+    "left"       -> Block LeftAligned <$> pBlockWidth <*> pBlockBorders
+    "right"      -> Block RightAligned <$> pBlockWidth <*> pBlockBorders
+    "center"     -> Block Centered <$> pBlockWidth <*> pBlockBorders
+    _            -> fail $ "Unknown pipe " ++ pipeName
 
 pBlockWidth :: Monad m => Parser m Int
 pBlockWidth = P.try (do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/doctemplates-0.8.1/test/pipes.test 
new/doctemplates-0.8.2/test/pipes.test
--- old/doctemplates-0.8.1/test/pipes.test      2019-11-24 18:27:38.000000000 
+0100
+++ new/doctemplates-0.8.2/test/pipes.test      2020-04-13 03:25:58.000000000 
+0200
@@ -50,6 +50,16 @@
 $for(bim/uppercase)$
 $it.Zub$
 $endfor$
+
+$digits/first$
+$digits/last$
+$for(digits/rest)$
+$it$
+$endfor$
+$for(digits/allbutlast)$
+$it$
+$endfor$
+$foo/first$
 .
 0
 2
@@ -89,3 +99,11 @@
 i v xx
 
 SIM
+
+1
+20
+5
+20
+1
+5
+1


Reply via email to