From 8523bb01b24424249aa409ea577388a1ea10d70a Mon Sep 17 00:00:00 2001 From: Albert Krewinkel <albert@zeitkraut.de> Date: Wed, 20 Oct 2021 21:40:07 +0200 Subject: Lua: marshal Attr values as userdata - Adds a new `pandoc.AttributeList()` constructor, which creates the associative attribute list that is used as the third component of `Attr` values. Values of this type can often be passed to constructors instead of `Attr` values. - `AttributeList` values can no longer be indexed numerically. --- src/Text/Pandoc/Lua/Module/Pandoc.hs | 3 +++ 1 file changed, 3 insertions(+) (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 84d6be360..34317276d 100644 --- a/src/Text/Pandoc/Lua/Module/Pandoc.hs +++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs @@ -29,6 +29,7 @@ import Text.Pandoc.Lua.Filter (SingletonsList (..), walkInlines, walkInlineLists, walkBlocks, walkBlockLists) 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.PandocLua (PandocLua, addFunction, liftPandocLua, loadDefaultModule) @@ -54,6 +55,8 @@ pushModule = do addFunction "walk_inline" (walkElement peekInline pushInline) -- Constructors addFunction "Pandoc" mkPandoc + addFunction "Attr" (liftPandocLua mkAttr) + addFunction "AttributeList" (liftPandocLua mkAttributeList) return 1 walkElement :: (Walkable (SingletonsList Inline) a, -- cgit v1.2.3