@@ -1,4 +1,5 @@
1−{-# LANGUAGE OverlappingInstances, FlexibleInstances, OverloadedStrings #-}
1+{-# LANGUAGE OverlappingInstances, FlexibleInstances, OverloadedStrings,
2+ ScopedTypeVariables #-}
23{-# OPTIONS_GHC -fno-warn-orphans #-}
34{- Copyright (C) 2012-2014 John MacFarlane <jgm@berkeley.edu>
45
@@ -128,6 +129,20 @@ instance StackValue MetaValue where
128129 valuetype (MetaInlines _) = Lua.TSTRING
129130 valuetype (MetaBlocks _) = Lua.TSTRING
130131
132+instance StackValue Citation where
133+ push lua cit = do
134+ Lua.createtable lua 6 0
135+ let addValue ((k :: String), v) = Lua.push lua k >> Lua.push lua v >>
136+ Lua.rawset lua (-3)
137+ addValue ("citationId", citationId cit)
138+ addValue ("citationPrefix", citationPrefix cit)
139+ addValue ("citationSuffix", citationSuffix cit)
140+ addValue ("citationMode", show (citationMode cit))
141+ addValue ("citationNoteNum", citationNoteNum cit)
142+ addValue ("citationHash", citationHash cit)
143+ peek = undefined
144+ valuetype _ = Lua.TTABLE
145+
131146-- | Convert Pandoc to custom markup.
132147writeCustom :: FilePath -> WriterOptions -> Pandoc -> IO String
133148writeCustom luaFile opts doc = do
@@ -225,7 +240,7 @@ inlineToCustom lua (Quoted SingleQuote lst) = callfunc lua "SingleQuoted" lst
225240
226241inlineToCustom lua (Quoted DoubleQuote lst) = callfunc lua "DoubleQuoted" lst
227242
228−inlineToCustom lua (Cite _ lst) = callfunc lua "Cite" lst
243+inlineToCustom lua (Cite cs lst) = callfunc lua "Cite" lst cs
229244
230245inlineToCustom lua (Code attr str) =
231246 callfunc lua "Code" (fromString str) (attrToMap attr)