aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Lua')
-rw-r--r--src/Text/Pandoc/Lua/Marshaling/Context.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Lua/Marshaling/Context.hs b/src/Text/Pandoc/Lua/Marshaling/Context.hs
index a9cc7f38e..e209fbd61 100644
--- a/src/Text/Pandoc/Lua/Marshaling/Context.hs
+++ b/src/Text/Pandoc/Lua/Marshaling/Context.hs
@@ -16,16 +16,18 @@ Marshaling instance for doctemplates Context and its components.
-}
module Text.Pandoc.Lua.Marshaling.Context () where
+import Prelude
import qualified Foreign.Lua as Lua
import Foreign.Lua (Pushable)
-import Text.DocTemplates (Context(..), Val(..))
+import Text.DocTemplates (Context(..), Val(..), TemplateTarget)
+import Text.DocLayout (render)
-instance Pushable a => Pushable (Context a) where
+instance (TemplateTarget a, Pushable a) => Pushable (Context a) where
push (Context m) = Lua.push m
-instance Pushable a => Pushable (Val a) where
+instance (TemplateTarget a, Pushable a) => Pushable (Val a) where
push NullVal = Lua.push ()
push (MapVal ctx) = Lua.push ctx
push (ListVal xs) = Lua.push xs
- push (SimpleVal x) = Lua.push x
+ push (SimpleVal d) = Lua.push $ render Nothing d