module Text.Pandoc.Lua.Module.Types
( pushModule
) where
import Data.Version (Version)
import Foreign.Lua (Lua, NumResults)
import Text.Pandoc.Definition
import Text.Pandoc.Lua.Marshaling.AST (LuaAttr, LuaListAttributes)
import Text.Pandoc.Lua.Marshaling.Version ()
import Text.Pandoc.Lua.Util (addFunction)
import qualified Foreign.Lua as Lua
pushModule :: Lua NumResults
pushModule :: Lua NumResults
pushModule = do
Lua ()
Lua.newtable
String -> (Version -> Lua Version) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Version" (Version -> Lua Version
forall (m :: * -> *) a. Monad m => a -> m a
return :: Version -> Lua Version)
Lua NumResults
pushCloneTable
StackIndex -> String -> Lua ()
Lua.setfield (CInt -> StackIndex
Lua.nthFromTop CInt
2) String
"clone"
NumResults -> Lua NumResults
forall (m :: * -> *) a. Monad m => a -> m a
return NumResults
1
pushCloneTable :: Lua NumResults
pushCloneTable :: Lua NumResults
pushCloneTable = do
Lua ()
Lua.newtable
String -> (LuaAttr -> Lua LuaAttr) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Attr" LuaAttr -> Lua LuaAttr
cloneAttr
String -> (Block -> Lua Block) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Block" Block -> Lua Block
cloneBlock
String -> (Citation -> Lua Citation) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Citation" Citation -> Lua Citation
cloneCitation
String -> (Inline -> Lua Inline) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Inline" Inline -> Lua Inline
cloneInline
String -> (Meta -> Lua Meta) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Meta" Meta -> Lua Meta
cloneMeta
String -> (MetaValue -> Lua MetaValue) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"MetaValue" MetaValue -> Lua MetaValue
cloneMetaValue
String -> (LuaListAttributes -> Lua LuaListAttributes) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"ListAttributes" LuaListAttributes -> Lua LuaListAttributes
cloneListAttributes
String -> (Pandoc -> Lua Pandoc) -> Lua ()
forall a. ToHaskellFunction a => String -> a -> Lua ()
addFunction String
"Pandoc" Pandoc -> Lua Pandoc
clonePandoc
NumResults -> Lua NumResults
forall (m :: * -> *) a. Monad m => a -> m a
return NumResults
1
cloneAttr :: LuaAttr -> Lua LuaAttr
cloneAttr :: LuaAttr -> Lua LuaAttr
cloneAttr = LuaAttr -> Lua LuaAttr
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneBlock :: Block -> Lua Block
cloneBlock :: Block -> Lua Block
cloneBlock = Block -> Lua Block
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneCitation :: Citation -> Lua Citation
cloneCitation :: Citation -> Lua Citation
cloneCitation = Citation -> Lua Citation
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneInline :: Inline -> Lua Inline
cloneInline :: Inline -> Lua Inline
cloneInline = Inline -> Lua Inline
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneListAttributes :: LuaListAttributes -> Lua LuaListAttributes
cloneListAttributes :: LuaListAttributes -> Lua LuaListAttributes
cloneListAttributes = LuaListAttributes -> Lua LuaListAttributes
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneMeta :: Meta -> Lua Meta
cloneMeta :: Meta -> Lua Meta
cloneMeta = Meta -> Lua Meta
forall (m :: * -> *) a. Monad m => a -> m a
return
cloneMetaValue :: MetaValue -> Lua MetaValue
cloneMetaValue :: MetaValue -> Lua MetaValue
cloneMetaValue = MetaValue -> Lua MetaValue
forall (m :: * -> *) a. Monad m => a -> m a
return
clonePandoc :: Pandoc -> Lua Pandoc
clonePandoc :: Pandoc -> Lua Pandoc
clonePandoc = Pandoc -> Lua Pandoc
forall (m :: * -> *) a. Monad m => a -> m a
return