diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-23 13:35:27 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-12-23 13:43:22 +0100 |
commit | 2c66a42ab81d40e771eda0f054c62f22ad45f3d0 (patch) | |
tree | de174a57e5cfc34dd85a1ae5304c302f1da1dbff /src/Text/Pandoc/Lua/Util.hs | |
parent | 35f0567a8fe840ca65f8474d0293942c76a1220f (diff) | |
download | pandoc-2c66a42ab81d40e771eda0f054c62f22ad45f3d0.tar.gz |
Lua modules: add function pandoc.utils.normalize_date
The function parses a date and converts it (if possible) to "YYYY-MM-DD"
format.
Diffstat (limited to 'src/Text/Pandoc/Lua/Util.hs')
-rw-r--r-- | src/Text/Pandoc/Lua/Util.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Lua/Util.hs b/src/Text/Pandoc/Lua/Util.hs index 28d09d339..1f7664fc0 100644 --- a/src/Text/Pandoc/Lua/Util.hs +++ b/src/Text/Pandoc/Lua/Util.hs @@ -125,6 +125,10 @@ instance FromLuaStack a => FromLuaStack (OrNil a) where then return (OrNil Nothing) else OrNil . Just <$> Lua.peek idx +instance ToLuaStack a => ToLuaStack (OrNil a) where + push (OrNil Nothing) = Lua.pushnil + push (OrNil (Just x)) = Lua.push x + -- | Helper class for pushing a single value to the stack via a lua function. -- See @pushViaCall@. class PushViaCall a where |