Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-pandoc-lua-marshal for 
openSUSE:Factory checked in at 2022-02-25 21:25:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-pandoc-lua-marshal (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-pandoc-lua-marshal.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-pandoc-lua-marshal"

Fri Feb 25 21:25:07 2022 rev:2 rq:957472 version:0.1.5

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/ghc-pandoc-lua-marshal/ghc-pandoc-lua-marshal.changes
    2022-02-11 23:10:23.079115194 +0100
+++ 
/work/SRC/openSUSE:Factory/.ghc-pandoc-lua-marshal.new.1958/ghc-pandoc-lua-marshal.changes
  2022-02-25 21:25:36.983644139 +0100
@@ -1,0 +2,16 @@
+Thu Feb 17 14:43:00 UTC 2022 - Peter Simons <[email protected]>
+
+- Update pandoc-lua-marshal to version 0.1.5.
+  ## 0.1.5
+
+  Released 2022-02-17.
+
+  -   Allow any type of callable object as argument to List
+      functions `filter`, `map`, and `find_if`. These previously
+      required the argument to be of type `function`, which was too
+      restrictive.
+
+  -   Inline: the type of Image captions is now `Inlines` instead
+      of `List`.
+
+-------------------------------------------------------------------

Old:
----
  pandoc-lua-marshal-0.1.4.tar.gz

New:
----
  pandoc-lua-marshal-0.1.5.tar.gz

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

Other differences:
------------------
++++++ ghc-pandoc-lua-marshal.spec ++++++
--- /var/tmp/diff_new_pack.JNgcIH/_old  2022-02-25 21:25:37.511644233 +0100
+++ /var/tmp/diff_new_pack.JNgcIH/_new  2022-02-25 21:25:37.515644234 +0100
@@ -19,7 +19,7 @@
 %global pkg_name pandoc-lua-marshal
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.1.4
+Version:        0.1.5
 Release:        0
 Summary:        Use pandoc types in Lua
 License:        MIT

++++++ pandoc-lua-marshal-0.1.4.tar.gz -> pandoc-lua-marshal-0.1.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-lua-marshal-0.1.4/CHANGELOG.md 
new/pandoc-lua-marshal-0.1.5/CHANGELOG.md
--- old/pandoc-lua-marshal-0.1.4/CHANGELOG.md   2001-09-09 03:46:40.000000000 
+0200
+++ new/pandoc-lua-marshal-0.1.5/CHANGELOG.md   2001-09-09 03:46:40.000000000 
+0200
@@ -2,6 +2,18 @@
 
 `pandoc-lua-marshal` uses [PVP Versioning][].
 
+## 0.1.5
+
+Released 2022-02-17.
+
+-   Allow any type of callable object as argument to List
+    functions `filter`, `map`, and `find_if`. These previously
+    required the argument to be of type `function`, which was too
+    restrictive.
+    
+-   Inline: the type of Image captions is now `Inlines` instead
+    of `List`.
+
 ## 0.1.4
 
 Released 2022-01-29.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-lua-marshal-0.1.4/cbits/listmod.c 
new/pandoc-lua-marshal-0.1.5/cbits/listmod.c
--- old/pandoc-lua-marshal-0.1.4/cbits/listmod.c        2001-09-09 
03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/cbits/listmod.c        2001-09-09 
03:46:40.000000000 +0200
@@ -29,6 +29,18 @@
 }
 
 /*
+** Check that 'arg' is either a function or a different callable object.
+*/
+static void checkcallable (lua_State *L, int arg) {
+  if (lua_type(L, arg) != LUA_TFUNCTION) { /* is it not a function? */
+    if (luaL_getmetafield(L, arg, "__call"))
+      lua_pop(L, 1); /* pop metamethod */
+    else
+      luaL_checktype(L, arg, LUA_TFUNCTION); /* force an error */
+  }
+}
+
+/*
 ** Creates a List from a table; uses a fresh, empty table if none is
 ** given.
 */
@@ -147,7 +159,7 @@
 static int list_filter (lua_State *L) {
   lua_settop(L, 2);
   luaL_checktype(L, 1, LUA_TTABLE);
-  luaL_checktype(L, 2, LUA_TFUNCTION);
+  checkcallable(L, 2);
   luaL_checkstack(L, 4, NULL);
   lua_Integer len = luaL_len(L, 1);
   lua_createtable(L, len, 0);  /* create new table */
@@ -197,7 +209,7 @@
 static int list_find_if (lua_State *L) {
   lua_settop(L, 3);
   luaL_checktype(L, 1, LUA_TTABLE);
-  luaL_checktype(L, 2, LUA_TFUNCTION);
+  checkcallable(L, 2);
   lua_Integer len = luaL_len(L, 1);
   lua_Integer start = posrelat(luaL_optinteger(L, 3, 1), len);
   for (lua_Integer i = start; i <= len; i++) {
@@ -237,7 +249,7 @@
 static int list_map(lua_State *L) {
   lua_settop(L, 2);
   luaL_checktype(L, 1, LUA_TTABLE);
-  luaL_checktype(L, 2, LUA_TFUNCTION);
+  checkcallable(L, 2);
   lua_Integer len = luaL_len(L, 1);
   lua_createtable(L, len, 0);  /* create new table */
   luaL_getmetatable(L, LIST_T);  /* make result a generic list */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-lua-marshal-0.1.4/pandoc-lua-marshal.cabal 
new/pandoc-lua-marshal-0.1.5/pandoc-lua-marshal.cabal
--- old/pandoc-lua-marshal-0.1.4/pandoc-lua-marshal.cabal       2001-09-09 
03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/pandoc-lua-marshal.cabal       2001-09-09 
03:46:40.000000000 +0200
@@ -1,6 +1,6 @@
 cabal-version:       2.4
 name:                pandoc-lua-marshal
-version:             0.1.4
+version:             0.1.5
 synopsis:            Use pandoc types in Lua
 description:         This package provides functions to marshal and unmarshal
                      pandoc document types to and from Lua.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Citation.hs 
new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Citation.hs
--- old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Citation.hs        
2001-09-09 03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Citation.hs        
2001-09-09 03:46:40.000000000 +0200
@@ -17,9 +17,10 @@
 import Control.Applicative (optional)
 import Data.Maybe (fromMaybe)
 import HsLua as Lua
-import Text.Pandoc.Lua.Marshal.CitationMode (peekCitationMode, 
pushCitationMode)
-import {-# SOURCE #-} Text.Pandoc.Lua.Marshal.Inline (peekInlinesFuzzy, 
pushInlines)
 import Text.Pandoc.Definition (Citation (..))
+import Text.Pandoc.Lua.Marshal.CitationMode (peekCitationMode, 
pushCitationMode)
+import {-# SOURCE #-} Text.Pandoc.Lua.Marshal.Inline
+  ( peekInlinesFuzzy, pushInlines )
 
 -- | Pushes a Citation value as userdata object.
 pushCitation :: LuaError e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Inline.hs 
new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Inline.hs
--- old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Inline.hs  
2001-09-09 03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Inline.hs  
2001-09-09 03:46:40.000000000 +0200
@@ -127,7 +127,7 @@
           _               -> const Absent)
 
   , possibleProperty "caption" "image caption"
-      (pushPandocList pushInline, \case
+      (pushInlines, \case
           Image _ capt _ -> Actual capt
           _              -> Absent)
       (peekInlinesFuzzy, \case
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Inline.hs-boot 
new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Inline.hs-boot
--- old/pandoc-lua-marshal-0.1.4/src/Text/Pandoc/Lua/Marshal/Inline.hs-boot     
2001-09-09 03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/src/Text/Pandoc/Lua/Marshal/Inline.hs-boot     
2001-09-09 03:46:40.000000000 +0200
@@ -1,4 +1,9 @@
 {-# LANGUAGE FlexibleContexts     #-}
+{-# LANGUAGE LambdaCase           #-}
+{-# LANGUAGE OverloadedStrings    #-}
+{-# LANGUAGE ScopedTypeVariables  #-}
+{-# LANGUAGE TypeApplications     #-}
+{-# LANGUAGE TupleSections        #-}
 module Text.Pandoc.Lua.Marshal.Inline
   ( -- * Single Inline elements
     peekInline
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-lua-marshal-0.1.4/test/test-inline.lua 
new/pandoc-lua-marshal-0.1.5/test/test-inline.lua
--- old/pandoc-lua-marshal-0.1.4/test/test-inline.lua   2001-09-09 
03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/test/test-inline.lua   2001-09-09 
03:46:40.000000000 +0200
@@ -60,12 +60,16 @@
       end)
     },
     group 'Image' {
-      test('has property `caption`', function ()
+      test('has property `caption` of type Inlines', function ()
         local img = Image('example', 'a.png')
         assert.are_same(img.caption, {Str 'example'})
 
         img.caption = 'A'
         assert.are_equal(img, Image({'A'}, 'a.png'))
+        assert.are_equal(
+          Image('example', 'a.png').caption,
+          Inlines('example')
+        )
       end),
       test('has property `src`', function ()
         local img = Image('example', 'sample.png')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pandoc-lua-marshal-0.1.4/test/test-list.lua 
new/pandoc-lua-marshal-0.1.5/test/test-list.lua
--- old/pandoc-lua-marshal-0.1.4/test/test-list.lua     2001-09-09 
03:46:40.000000000 +0200
+++ new/pandoc-lua-marshal-0.1.5/test/test-list.lua     2001-09-09 
03:46:40.000000000 +0200
@@ -59,7 +59,21 @@
           args,
           List{{0, 1}, {1, 2}, {1, 3}, {2, 4}, {3, 5}, {5, 6}, {8, 7}}
         )
-      end)
+      end),
+      test('accepts callable table as function', function ()
+        local always_true = function (t, x) return true end
+        local callable = setmetatable({}, {__call = always_true})
+        assert.are_same(
+          List{0},
+          List{0}:filter(callable)
+        )
+      end),
+      test('fails on non-callable table', function ()
+        assert.error_matches(
+          function () List{1}:filter({}) end,
+          'bad argument %#1 to \'filter\' %(function expected, got table%)'
+        )
+      end),
     },
 
     group 'find' {
@@ -85,7 +99,7 @@
           function () List:new{}:find(0, 'NaN') end,
           'number expected, got string'
         )
-      end)
+      end),
     },
 
     group 'find_if' {
@@ -117,7 +131,18 @@
           function () List:new{}:find(0, 'NaN') end,
           'number expected, got string'
         )
-      end)
+      end),
+      test('accepts callable table', function ()
+        local always_true = function (t, x) return true end
+        local callable = setmetatable({}, {__call = always_true})
+        assert.are_equal(List{1}:find_if(callable), 1)
+      end),
+      test('fails on non-callable table', function ()
+         assert.error_matches(
+           function () List():find_if({}) end,
+           'bad argument %#1 to \'find_if\' %(function expected, got table%)'
+         )
+      end),
     },
 
     group 'includes' {
@@ -176,7 +201,18 @@
           debug.getmetatable(custom:map(tostring)).__name,
           'List'
         )
-      end)
+      end),
+      test('accepts callable table', function ()
+        local plus_length = function (t, x) return x + #t end
+        local callable = setmetatable({1, 2}, {__call = plus_length})
+        assert.are_equal(List{1, 3}:map(callable), List{3, 5})
+      end),
+      test('fails on non-callable table', function ()
+        assert.error_matches(
+          function () List{1}:map({}) end,
+          'bad argument %#1 to \'map\' %(function expected, got table%)'
+        )
+      end),
     },
 
     group 'new' {

Reply via email to