summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/pandoc.lua28
-rw-r--r--src/Text/Pandoc/Lua/StackInstances.hs12
2 files changed, 21 insertions, 19 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index e56df3b6d..79eb4b90e 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -764,6 +764,8 @@ M.Attr.__newindex = function(t, k, v)
end
setmetatable(M.Attr, M.Attr)
+-- Citation
+M.Citation = {}
--- Creates a single citation.
-- @function Citation
@@ -773,20 +775,20 @@ setmetatable(M.Attr, M.Attr)
-- @tparam[opt] {Inline,...} suffix citation suffix
-- @tparam[opt] int note_num note number
-- @tparam[opt] int hash hash number
-M.Citation = function(id, mode, prefix, suffix, note_num, hash)
- prefix = prefix or {}
- suffix = suffix or {}
- note_num = note_num or 0
- hash = hash or 0
- return {
- citationId = id,
- citationPrefix = prefix,
- citationSuffix = suffix,
- citationMode = mode,
- citationNoteNum = note_num,
- citationHash = hash,
- }
+M.Citation.__call = function(t, id, mode, prefix, suffix, note_num, hash)
+ return setmetatable(
+ {
+ id = id,
+ mode = mode,
+ prefix = prefix or {},
+ suffix = suffix or {},
+ note_num = note_num or 0,
+ hash = hash or 0,
+ },
+ t
+ )
end
+setmetatable(M.Citation, M.Citation)
------------------------------------------------------------------------
diff --git a/src/Text/Pandoc/Lua/StackInstances.hs b/src/Text/Pandoc/Lua/StackInstances.hs
index 119946b78..c669f2865 100644
--- a/src/Text/Pandoc/Lua/StackInstances.hs
+++ b/src/Text/Pandoc/Lua/StackInstances.hs
@@ -84,12 +84,12 @@ instance ToLuaStack Citation where
instance FromLuaStack Citation where
peek idx = do
- id' <- getTable idx "citationId"
- prefix <- getTable idx "citationPrefix"
- suffix <- getTable idx "citationSuffix"
- mode <- getTable idx "citationMode"
- num <- getTable idx "citationNoteNum"
- hash <- getTable idx "citationHash"
+ id' <- getTable idx "id"
+ prefix <- getTable idx "prefix"
+ suffix <- getTable idx "suffix"
+ mode <- getTable idx "mode"
+ num <- getTable idx "note_num"
+ hash <- getTable idx "hash"
return $ Citation id' prefix suffix mode num hash
instance ToLuaStack Alignment where