data/pandoc.lua: fix attribute names of Citation
The fields were named like the Haskell fields, not like the documented, shorter version. The names are changed to match the documentation and Citations are given a shared metatable to enable simple extensibility. Fixes: #4222
This commit is contained in:
parent
856bc54526
commit
4f564b9203
2 changed files with 21 additions and 19 deletions
|
@ -764,6 +764,8 @@ M.Attr.__newindex = function(t, k, v)
|
||||||
end
|
end
|
||||||
setmetatable(M.Attr, M.Attr)
|
setmetatable(M.Attr, M.Attr)
|
||||||
|
|
||||||
|
-- Citation
|
||||||
|
M.Citation = {}
|
||||||
|
|
||||||
--- Creates a single citation.
|
--- Creates a single citation.
|
||||||
-- @function Citation
|
-- @function Citation
|
||||||
|
@ -773,20 +775,20 @@ setmetatable(M.Attr, M.Attr)
|
||||||
-- @tparam[opt] {Inline,...} suffix citation suffix
|
-- @tparam[opt] {Inline,...} suffix citation suffix
|
||||||
-- @tparam[opt] int note_num note number
|
-- @tparam[opt] int note_num note number
|
||||||
-- @tparam[opt] int hash hash number
|
-- @tparam[opt] int hash hash number
|
||||||
M.Citation = function(id, mode, prefix, suffix, note_num, hash)
|
M.Citation.__call = function(t, id, mode, prefix, suffix, note_num, hash)
|
||||||
prefix = prefix or {}
|
return setmetatable(
|
||||||
suffix = suffix or {}
|
{
|
||||||
note_num = note_num or 0
|
id = id,
|
||||||
hash = hash or 0
|
mode = mode,
|
||||||
return {
|
prefix = prefix or {},
|
||||||
citationId = id,
|
suffix = suffix or {},
|
||||||
citationPrefix = prefix,
|
note_num = note_num or 0,
|
||||||
citationSuffix = suffix,
|
hash = hash or 0,
|
||||||
citationMode = mode,
|
},
|
||||||
citationNoteNum = note_num,
|
t
|
||||||
citationHash = hash,
|
)
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
setmetatable(M.Citation, M.Citation)
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
|
@ -84,12 +84,12 @@ instance ToLuaStack Citation where
|
||||||
|
|
||||||
instance FromLuaStack Citation where
|
instance FromLuaStack Citation where
|
||||||
peek idx = do
|
peek idx = do
|
||||||
id' <- getTable idx "citationId"
|
id' <- getTable idx "id"
|
||||||
prefix <- getTable idx "citationPrefix"
|
prefix <- getTable idx "prefix"
|
||||||
suffix <- getTable idx "citationSuffix"
|
suffix <- getTable idx "suffix"
|
||||||
mode <- getTable idx "citationMode"
|
mode <- getTable idx "mode"
|
||||||
num <- getTable idx "citationNoteNum"
|
num <- getTable idx "note_num"
|
||||||
hash <- getTable idx "citationHash"
|
hash <- getTable idx "hash"
|
||||||
return $ Citation id' prefix suffix mode num hash
|
return $ Citation id' prefix suffix mode num hash
|
||||||
|
|
||||||
instance ToLuaStack Alignment where
|
instance ToLuaStack Alignment where
|
||||||
|
|
Loading…
Reference in a new issue