Skip to content

Commit 08ed513

Browse files
committed
latex,tables - check for nil before handling caption
1 parent 240f91c commit 08ed513

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/resources/filters/layout/latex.lua

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,16 @@ function latexCell(cell, vAlign, endOfRow, endOfTable)
351351
content:insert(pandoc.Para(caption))
352352
cellOutput = true
353353
elseif isFigure then
354-
local caption = refCaptionFromDiv(cell).content
355-
markupLatexCaption(cell, caption)
356-
content:insert(pandoc.RawBlock("latex", "\\raisebox{-\\height}{"))
357-
tappend(content, tslice(cell.content, 1, #cell.content-1))
358-
content:insert(pandoc.RawBlock("latex", "}"))
359-
content:insert(pandoc.Para(caption))
360-
cellOutput = true
354+
local caption_el = refCaptionFromDiv(cell)
355+
if caption_el ~= nil then
356+
local caption = caption_el.content
357+
markupLatexCaption(cell, caption)
358+
content:insert(pandoc.RawBlock("latex", "\\raisebox{-\\height}{"))
359+
tappend(content, tslice(cell.content, 1, #cell.content-1))
360+
content:insert(pandoc.RawBlock("latex", "}"))
361+
content:insert(pandoc.Para(caption))
362+
cellOutput = true
363+
end
361364
end
362365
end
363366

0 commit comments

Comments
 (0)