blob: bb4f02c3cf59d89a68f3d1f9af0f23fdb4562e9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{- |
Module : Text.Pandoc.Lua.Module.Types
Copyright : © 2019-2021 Albert Krewinkel
License : GNU GPL, version 2 or above
Maintainer : Albert Krewinkel <tarleb+pandoc@moltkeplatz.de>
Stability : alpha
Pandoc data type constructors.
-}
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
-- | Push the pandoc.system module on the Lua stack.
pushModule :: Lua NumResults
pushModule = do
Lua.newtable
addFunction "Version" (return :: Version -> Lua Version)
pushCloneTable
Lua.setfield (Lua.nthFromTop 2) "clone"
return 1
pushCloneTable :: Lua NumResults
pushCloneTable = do
Lua.newtable
addFunction "Attr" cloneAttr
addFunction "Block" cloneBlock
addFunction "Citation" cloneCitation
addFunction "Inline" cloneInline
addFunction "Meta" cloneMeta
addFunction "MetaValue" cloneMetaValue
addFunction "ListAttributes" cloneListAttributes
addFunction "Pandoc" clonePandoc
return 1
cloneAttr :: LuaAttr -> Lua LuaAttr
cloneAttr = return
cloneBlock :: Block -> Lua Block
cloneBlock = return
cloneCitation :: Citation -> Lua Citation
cloneCitation = return
cloneInline :: Inline -> Lua Inline
cloneInline = return
cloneListAttributes :: LuaListAttributes -> Lua LuaListAttributes
cloneListAttributes = return
cloneMeta :: Meta -> Lua Meta
cloneMeta = return
cloneMetaValue :: MetaValue -> Lua MetaValue
cloneMetaValue = return
clonePandoc :: Pandoc -> Lua Pandoc
clonePandoc = return
|