diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2021-12-25 20:47:29 +0100 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2021-12-25 21:20:18 +0100 |
commit | fbd2c8e376eea5eccc0b799f8e48d10c7ab8b6d9 (patch) | |
tree | 448a170d242018acc73e765dd18cd11f26df8b4d /test/lua | |
parent | e54f6dcd7a6367d6d6408a4a5151b703aef3c533 (diff) | |
download | pandoc-fbd2c8e376eea5eccc0b799f8e48d10c7ab8b6d9.tar.gz |
Lua: improve handling of empty caption, body by `from_simple_table`
Create truly empty table caption and body when these are empty in the
simple table.
Fixes: #7776
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/module/pandoc-utils.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/lua/module/pandoc-utils.lua b/test/lua/module/pandoc-utils.lua index 0475e96ec..4cf2c84a7 100644 --- a/test/lua/module/pandoc-utils.lua +++ b/test/lua/module/pandoc-utils.lua @@ -302,5 +302,32 @@ return { -- reversible assert.are_same(simple_table, utils.to_simple_table(tbl)) end), + test('empty caption', function () + local simple_table = pandoc.SimpleTable( + {}, + {pandoc.AlignDefault}, + {0}, + {{pandoc.Plain 'a'}}, + {{{pandoc.Plain 'b'}}} + ) + local tbl = utils.from_simple_table(simple_table) + assert.are_equal( + pandoc.Blocks{}, + tbl.caption.long + ) + assert.is_nil(tbl.caption.short) + end), + test('empty body', function () + local simple_table = pandoc.SimpleTable( + pandoc.Inlines('a nice caption'), + {pandoc.AlignDefault}, + {0}, + {{pandoc.Plain 'a'}}, + {} + ) + local tbl = utils.from_simple_table(simple_table) + tbl.bodies:map(print) + assert.are_same(pandoc.List(), tbl.bodies) + end), } } |