@@ -107,6 +107,19 @@ instance StackValue [Block] where
107107 peek _ _ = undefined
108108 valuetype _ = Lua.TSTRING
109109
110+instance StackValue MetaValue where
111+ push l (MetaMap m) = Lua.push l m
112+ push l (MetaList xs) = Lua.push l xs
113+ push l (MetaString s) = Lua.push l s
114+ push l (MetaInlines ils) = Lua.push l ils
115+ push l (MetaBlocks bs) = Lua.push l bs
116+ peek _ _ = undefined
117+ valuetype (MetaMap _) = Lua.TTABLE
118+ valuetype (MetaList _) = Lua.TTABLE
119+ valuetype (MetaString _) = Lua.TSTRING
120+ valuetype (MetaInlines _) = Lua.TSTRING
121+ valuetype (MetaBlocks _) = Lua.TSTRING
122+
110123-- | Convert Pandoc to custom markup.
111124writeCustom :: FilePath -> WriterOptions -> Pandoc -> IO String
112125writeCustom luaFile opts doc = do
@@ -121,12 +134,9 @@ writeCustom luaFile opts doc = do
121134 return $ toString rendered
122135
123136docToCustom :: LuaState -> WriterOptions -> Pandoc -> IO ByteString
124−docToCustom lua opts (Pandoc meta blocks) = do
125− title' <- inlineListToCustom lua $ docTitle meta
126− authors' <- mapM (inlineListToCustom lua) $ docAuthors meta
127− date' <- inlineListToCustom lua $ docDate meta
137+docToCustom lua opts (Pandoc (Meta metamap) blocks) = do
128138 body <- blockListToCustom lua blocks
129− callfunc lua "Doc" body title' authors' date' (writerVariables opts)
139+ callfunc lua "Doc" body metamap (writerVariables opts)
130140
131141-- | Convert Pandoc block element to Custom.
132142blockToCustom :: LuaState -- ^ Lua state