Skip to content

Commit 51c8800

Browse files
committed
[WIP] Cleanup parsefiguredivs filters
1 parent cc7d692 commit 51c8800

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/resources/filters/quarto-pre/parsefiguredivs.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function parse_floatreftargets()
236236
end
237237
local caption = refCaptionFromDiv(div)
238238
if caption ~= nil then
239-
div.content:remove(#div.content)
239+
div.content:remove() -- drop the last element
240240
elseif div.attributes[caption_attr_key] ~= nil then
241241
caption = pandoc.Plain(string_to_quarto_ast_inlines(div.attributes[caption_attr_key]))
242242
div.attributes[caption_attr_key] = nil
@@ -246,7 +246,8 @@ function parse_floatreftargets()
246246
local found_caption = false
247247
content = _quarto.ast.walk(content, {
248248
Table = function(table)
249-
if table.caption.long ~= nil then
249+
-- check if caption is non-empty
250+
if next(table.caption.long) then
250251
found_caption = true
251252
caption = table.caption.long[1] -- what if there's more than one entry here?
252253
table.caption.long = nil

0 commit comments

Comments
 (0)