aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-01-01 14:11:17 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2018-01-01 14:11:49 -0800
commitecc46e229fde934f163d1f646383d24bfe2039e1 (patch)
treea7cb46ec8ec2824882e1b6ecdb2ddeb8c800a02a
parente6b04fa0cfbb9453dbb203a71740ef6c3404d589 (diff)
downloadpandoc-ecc46e229fde934f163d1f646383d24bfe2039e1.tar.gz
Lua.Module.Utils: make stringify work on MetaValues.
I'm sure this was intended in the first place, but currently only Meta is supported.
-rw-r--r--src/Text/Pandoc/Lua/Module/Utils.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs
index 35495dae1..c0d7397ce 100644
--- a/src/Text/Pandoc/Lua/Module/Utils.hs
+++ b/src/Text/Pandoc/Lua/Module/Utils.hs
@@ -31,7 +31,7 @@ module Text.Pandoc.Lua.Module.Utils
import Control.Applicative ((<|>))
import Foreign.Lua (FromLuaStack, Lua, LuaInteger, NumResults)
-import Text.Pandoc.Definition (Pandoc, Meta, Block, Inline)
+import Text.Pandoc.Definition (Pandoc, Meta, MetaValue, Block, Inline)
import Text.Pandoc.Lua.StackInstances ()
import Text.Pandoc.Lua.Util (OrNil (OrNil), addFunction)
@@ -76,12 +76,14 @@ stringify el = return $ case el of
InlineElement i -> Shared.stringify i
BlockElement b -> Shared.stringify b
MetaElement m -> Shared.stringify m
+ MetaValueElement m -> Shared.stringify m
data AstElement
= PandocElement Pandoc
| MetaElement Meta
| BlockElement Block
| InlineElement Inline
+ | MetaValueElement MetaValue
deriving (Show)
instance FromLuaStack AstElement where
@@ -90,6 +92,7 @@ instance FromLuaStack AstElement where
<|> (InlineElement <$> Lua.peek idx)
<|> (BlockElement <$> Lua.peek idx)
<|> (MetaElement <$> Lua.peek idx)
+ <|> (MetaValueElement <$> Lua.peek idx)
case res of
Right x -> return x
Left _ -> Lua.throwLuaError