diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-05 08:15:43 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2018-01-05 08:20:59 +0100 |
commit | 4f564b92030168a5416f8ca07530d189f3a6f277 (patch) | |
tree | 2d0810e76666b8f6a20ab487fd021a17cafa3383 /data/pandoc.lua | |
parent | 856bc54526fc01b48a2d770406fcb9aaa2fa5da3 (diff) |
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
Diffstat (limited to 'data/pandoc.lua')
-rw-r--r-- | data/pandoc.lua | 28 |
1 files changed, 15 insertions, 13 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) ------------------------------------------------------------------------ |