Lua: restore List behavior of MetaList
Fixes a regression introduced in 2.16 which had MetaList elements loose the `pandoc.List` properties. Fixes #7650
This commit is contained in:
parent
171bfd3d65
commit
96e76d4cd4
2 changed files with 14 additions and 0 deletions
|
@ -55,6 +55,7 @@ local function create_accessor_behavior (tag)
|
||||||
if k == "t" then
|
if k == "t" then
|
||||||
return getmetatable(t)["tag"]
|
return getmetatable(t)["tag"]
|
||||||
end
|
end
|
||||||
|
return getmetatable(t)[k]
|
||||||
end
|
end
|
||||||
behavior.__pairs = function (t)
|
behavior.__pairs = function (t)
|
||||||
return next, t
|
return next, t
|
||||||
|
|
|
@ -278,6 +278,19 @@ return {
|
||||||
end)
|
end)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
group 'MetaValue elements' {
|
||||||
|
test('MetaList elements behave like lists', function ()
|
||||||
|
local metalist = pandoc.MetaList{}
|
||||||
|
assert.are_equal(type(metalist.insert), 'function')
|
||||||
|
assert.are_equal(type(metalist.remove), 'function')
|
||||||
|
end),
|
||||||
|
test('MetaList, MetaMap, MetaInlines, MetaBlocks have `t` tag', function ()
|
||||||
|
assert.are_equal((pandoc.MetaList{}).t, 'MetaList')
|
||||||
|
assert.are_equal((pandoc.MetaMap{}).t, 'MetaMap')
|
||||||
|
assert.are_equal((pandoc.MetaInlines{}).t, 'MetaInlines')
|
||||||
|
assert.are_equal((pandoc.MetaBlocks{}).t, 'MetaBlocks')
|
||||||
|
end)
|
||||||
|
},
|
||||||
group 'Other types' {
|
group 'Other types' {
|
||||||
group 'SimpleTable' {
|
group 'SimpleTable' {
|
||||||
test('can access properties', function ()
|
test('can access properties', function ()
|
||||||
|
|
Loading…
Reference in a new issue