summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Custom.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-04-14 18:26:42 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2017-04-14 18:26:42 +0200
commitfeb1c1a9301667cc3b6c36c5fda65c7014cfcdcf (patch)
tree2aa863d71c0b65abe1363880b124e26516d9d457 /src/Text/Pandoc/Writers/Custom.hs
parent1d9742bb5dd976d478db877c48d9ba005ce98098 (diff)
Extract lua helper functions into Lua.Util module
Diffstat (limited to 'src/Text/Pandoc/Writers/Custom.hs')
-rw-r--r--src/Text/Pandoc/Writers/Custom.hs17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/Custom.hs b/src/Text/Pandoc/Writers/Custom.hs
index 58b222997..b06dd0c8a 100644
--- a/src/Text/Pandoc/Writers/Custom.hs
+++ b/src/Text/Pandoc/Writers/Custom.hs
@@ -2,8 +2,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE ScopedTypeVariables #-}
#if MIN_VERSION_base(4,8,0)
#else
{-# LANGUAGE OverlappingInstances #-}
@@ -48,6 +46,7 @@ import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8)
import Scripting.Lua (LuaState, StackValue, callfunc)
import qualified Scripting.Lua as Lua
import Text.Pandoc.Lua.Compat ( loadstring )
+import Text.Pandoc.Lua.Util ( addValue )
import Text.Pandoc.Definition
import Text.Pandoc.Options
import Text.Pandoc.Templates
@@ -131,14 +130,12 @@ instance StackValue MetaValue where
instance StackValue Citation where
push lua cit = do
Lua.createtable lua 6 0
- let addValue (k :: String, v) = Lua.push lua k >> Lua.push lua v >>
- Lua.rawset lua (-3)
- addValue ("citationId", citationId cit)
- addValue ("citationPrefix", citationPrefix cit)
- addValue ("citationSuffix", citationSuffix cit)
- addValue ("citationMode", show (citationMode cit))
- addValue ("citationNoteNum", citationNoteNum cit)
- addValue ("citationHash", citationHash cit)
+ addValue lua "citationId" $ citationId cit
+ addValue lua "citationPrefix" $ citationPrefix cit
+ addValue lua "citationSuffix" $ citationSuffix cit
+ addValue lua "citationMode" $ show (citationMode cit)
+ addValue lua "citationNoteNum" $ citationNoteNum cit
+ addValue lua "citationHash" $ citationHash cit
peek = undefined
valuetype _ = Lua.TTABLE