From f56d8706312df64d3956cea0c93768b51192958e Mon Sep 17 00:00:00 2001
From: Albert Krewinkel <albert@zeitkraut.de>
Date: Tue, 26 Oct 2021 14:40:11 +0200
Subject: Lua: marshal ListAttributes values as userdata objects

---
 src/Text/Pandoc/Lua/Module/Pandoc.hs | 4 ++++
 src/Text/Pandoc/Lua/Module/Types.hs  | 1 -
 src/Text/Pandoc/Lua/Module/Utils.hs  | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/Text/Pandoc/Lua/Module')

diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs
index f08914eba..340c324ad 100644
--- a/src/Text/Pandoc/Lua/Module/Pandoc.hs
+++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs
@@ -34,6 +34,8 @@ import Text.Pandoc.Lua.Marshaling ()
 import Text.Pandoc.Lua.Marshaling.AST
 import Text.Pandoc.Lua.Marshaling.Attr (mkAttr, mkAttributeList)
 import Text.Pandoc.Lua.Marshaling.List (List (..))
+import Text.Pandoc.Lua.Marshaling.ListAttributes ( mkListAttributes
+                                                 , peekListAttributes)
 import Text.Pandoc.Lua.PandocLua (PandocLua, addFunction, liftPandocLua,
                                   loadDefaultModule)
 import Text.Pandoc.Options (ReaderOptions (readerExtensions))
@@ -301,6 +303,8 @@ otherConstructors =
     <#> optionalParameter peekIntegral "hash" "integer" "hash number"
     =#> functionResult pushCitation "Citation" "new citation object"
     #? "Creates a single citation."
+
+  , mkListAttributes
   ]
 
 walkElement :: (Walkable (SingletonsList Inline) a,
diff --git a/src/Text/Pandoc/Lua/Module/Types.hs b/src/Text/Pandoc/Lua/Module/Types.hs
index fb09235de..ff4a4e0d5 100644
--- a/src/Text/Pandoc/Lua/Module/Types.hs
+++ b/src/Text/Pandoc/Lua/Module/Types.hs
@@ -37,7 +37,6 @@ pushCloneTable = do
   Lua.newtable
   addFunction "Meta"      $ cloneWith peekMeta Lua.push
   addFunction "MetaValue" $ cloneWith peekMetaValue pushMetaValue
-  addFunction "ListAttributes" $ cloneWith peekListAttributes pushListAttributes
   return 1
 
 cloneWith :: Peeker PandocError a
diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs
index 7ce1cd18d..f83c34af7 100644
--- a/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -29,7 +29,8 @@ import Text.Pandoc.Error (PandocError)
 import Text.Pandoc.Lua.Marshaling ()
 import Text.Pandoc.Lua.Marshaling.AST
   ( peekBlock, peekInline, peekPandoc, pushBlock, pushInline, pushPandoc
-  , peekAttr, peekListAttributes, peekMeta, peekMetaValue)
+  , peekAttr, peekMeta, peekMetaValue)
+import Text.Pandoc.Lua.Marshaling.ListAttributes (peekListAttributes)
 import Text.Pandoc.Lua.Marshaling.List (pushPandocList)
 import Text.Pandoc.Lua.Marshaling.SimpleTable
   ( SimpleTable (..), peekSimpleTable, pushSimpleTable )
-- 
cgit v1.2.3