diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2021-10-26 14:40:11 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2021-10-26 14:40:11 +0200 |
commit | f56d8706312df64d3956cea0c93768b51192958e (patch) | |
tree | 974b98342187a9b6db1fac01e9a085dab493e34c /data | |
parent | a493c7029cf2bc8490d96fff04b0a0c624987601 (diff) | |
download | pandoc-f56d8706312df64d3956cea0c93768b51192958e.tar.gz |
Lua: marshal ListAttributes values as userdata objects
Diffstat (limited to 'data')
-rw-r--r-- | data/pandoc.lua | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua index a20ce1e8c..2bbf0213e 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -349,48 +349,6 @@ function M.MetaBool(bool) end ------------------------------------------------------------------------ --- Element components --- @section components - --- ListAttributes -M.ListAttributes = AstElement:make_subtype 'ListAttributes' -M.ListAttributes.behavior.clone = M.types.clone.ListAttributes - ---- Creates a set of list attributes. --- @function ListAttributes --- @tparam[opt] integer start number of the first list item --- @tparam[opt] string style style used for list numbering --- @tparam[opt] DefaultDelim|Period|OneParen|TwoParens delimiter delimiter of list numbers --- @treturn table list attributes table -function M.ListAttributes:new (start, style, delimiter) - start = start or 1 - style = style or 'DefaultStyle' - delimiter = delimiter or 'DefaultDelim' - return {start, style, delimiter} -end -M.ListAttributes.behavior._field_names = {start = 1, style = 2, delimiter = 3} -M.ListAttributes.behavior.__eq = utils.equals -M.ListAttributes.behavior.__index = function (t, k) - return rawget(t, getmetatable(t)._field_names[k]) or - getmetatable(t)[k] -end -M.ListAttributes.behavior.__newindex = function (t, k, v) - if getmetatable(t)._field_names[k] then - rawset(t, getmetatable(t)._field_names[k], v) - else - rawset(t, k, v) - end -end -M.ListAttributes.behavior.__pairs = function(t) - local field_names = M.ListAttributes.behavior._field_names - local fields = {} - for name, i in pairs(field_names) do - fields[i] = name - end - return make_next_function(fields), t, nil -end - --- -- Legacy and compatibility types -- |