From 1fe97422630d4aa5644d55b0b3b41b0978b7fea0 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Sun, 20 Oct 2019 22:49:04 -0700
Subject: Changes to build with new doctemplates/doclayout.

The new version of doctemplates adds many features to pandoc's
templating system, while remaining backwards-compatible.
New features include partials and filters.  Using template filters,
one can lay out data in enumerated lists and tables.

Templates are now layout-sensitive: so, for example, if a
text with soft line breaks is interpolated near the end of
a line, the text will break and wrap naturally.  This makes
the templating system much more suitable for programatically
generating markdown or other plain-text files from metadata.
---
 src/Text/Pandoc/Lua/Marshaling/Context.hs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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

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
 
-- 
cgit v1.2.3