git.iko.soy/typeable/pandoc
on master help sign in
Lua.Module.Utils: make stringify work on MetaValues.

I'm sure this was intended in the first place, but currently only Meta is supported.

commitecc46e229fde934f163d1f646383d24bfe2039e1 authorJohn MacFarlane <jgm@berkeley.edu> dateMon 1 Jan 2018, 14:11 (9 years ago) parente6b04fa
1 file changed+4−1
src/Text/Pandoc/Lua/Module/Utils.hs+4−1
src/Text/Pandoc/Lua/Module/Utils.hs+4−1
@@ -31,7 +31,7 @@ module Text.Pandoc.Lua.Module.Utils
3131
3232import Control.Applicative ((<|>))
3333import Foreign.Lua (FromLuaStack, Lua, LuaInteger, NumResults)
34−import Text.Pandoc.Definition (Pandoc, Meta, Block, Inline)
34+import Text.Pandoc.Definition (Pandoc, Meta, MetaValue, Block, Inline)
3535import Text.Pandoc.Lua.StackInstances ()
3636import Text.Pandoc.Lua.Util (OrNil (OrNil), addFunction)
3737
@@ -76,12 +76,14 @@ stringify el = return $ case el of
7676 InlineElement i -> Shared.stringify i
7777 BlockElement b -> Shared.stringify b
7878 MetaElement m -> Shared.stringify m
79+ MetaValueElement m -> Shared.stringify m
7980
8081data AstElement
8182 = PandocElement Pandoc
8283 | MetaElement Meta
8384 | BlockElement Block
8485 | InlineElement Inline
86+ | MetaValueElement MetaValue
8587 deriving (Show)
8688
8789instance FromLuaStack AstElement where
@@ -90,6 +92,7 @@ instance FromLuaStack AstElement where
9092 <|> (InlineElement <$> Lua.peek idx)
9193 <|> (BlockElement <$> Lua.peek idx)
9294 <|> (MetaElement <$> Lua.peek idx)
95+ <|> (MetaValueElement <$> Lua.peek idx)
9396 case res of
9497 Right x -> return x
9598 Left _ -> Lua.throwLuaError