Skip to content

Commit

Permalink
fix for layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid committed Nov 2, 2023
1 parent 213f25b commit 97fc325
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/resources/filters/customnodes/floatreftarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,21 @@ _quarto.ast.add_handler({
end
})

function cap_location(float)
local ref = refType(float.identifier)
function cap_location(float_or_layout)
local ref = refType(float_or_layout.identifier)
-- layouts might not have good identifiers, but they might have
-- ref-parents
if ref == nil then
ref = refType(float_or_layout.attributes["ref-parent"])
end
-- last resort, pretend we're a figure
if ref == nil then
ref = "fig"
end
local qualified_key = ref .. '-cap-location'
local result = (
float.attributes[qualified_key] or
float.attributes['cap-location'] or
float_or_layout.attributes[qualified_key] or
float_or_layout.attributes['cap-location'] or
option_as_string(qualified_key) or
option_as_string('cap-location') or
crossref.categories.by_ref_type[ref].default_caption_location)
Expand Down

0 comments on commit 97fc325

Please sign in to comment.