Skip to content

Commit

Permalink
be more robust when searching for longtable rawblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid committed Nov 16, 2023
1 parent c571c08 commit 9e4d200
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/resources/filters/customnodes/floatreftarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,16 @@ end, function(float)
})

-- special case for singleton longtable floats
if float_type == "tbl" then
local raw = quarto.utils.match("Div/.cell-output-display/[1]/RawBlock")(float.content)
if raw and _quarto.format.isRawLatex(raw) and raw.text:match(_quarto.patterns.latexLongtablePattern) then
if float_type == "tbl" then
local raw
_quarto.ast.walk(float.content, {
RawBlock = function(el)
if _quarto.format.isRawLatex(el) and el.text:match(_quarto.patterns.latexLongtablePattern) then
raw = el
end
end
})
if raw then
local longtable_content = raw.text:gsub(_quarto.patterns.latexLongtablePattern, "%2", 1)
-- split the content into params and actual content
-- params are everything in the first line of longtable_content
Expand Down

0 comments on commit 9e4d200

Please sign in to comment.