@@ -87,6 +87,15 @@ instance ToLuaStack (Stringify Citation) where
8787 addValue "citationNoteNum" $ citationNoteNum cit
8888 addValue "citationHash" $ citationHash cit
8989
90+-- | Key-value pair, pushed as a table with @a@ as the only key and @v@ as the
91+-- associated value.
92+newtype KeyValue a b = KeyValue (a, b)
93+
94+instance (ToLuaStack a, ToLuaStack b) => ToLuaStack (KeyValue a b) where
95+ push (KeyValue (k, v)) = do
96+ newtable
97+ addValue k v
98+
9099data PandocLuaException = PandocLuaException String
91100 deriving (Show, Typeable)
92101
@@ -165,7 +174,8 @@ blockToCustom (OrderedList (num,sty,delim) items) =
165174 callFunc "OrderedList" (map Stringify items) num (show sty) (show delim)
166175
167176blockToCustom (DefinitionList items) =
168− callFunc "DefinitionList" (map (Stringify *** map Stringify) items)
177+ callFunc "DefinitionList"
178+ (map (KeyValue . (Stringify *** map Stringify)) items)
169179
170180blockToCustom (Div attr items) =
171181 callFunc "Div" (Stringify items) (attrToMap attr)