Skip to content

Commit

Permalink
forward panel layout margin-caption attributes correctly. Closes #1173
Browse files Browse the repository at this point in the history
  • Loading branch information
cscheid committed Dec 13, 2023
1 parent 8a469b5 commit b82d779
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/resources/filters/layout/columns-preprocess.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
function columns_preprocess()
return {
FloatRefTarget = function(float)
if float.parent_id ~= nil then
return nil
end
local location = cap_location(float)
if location == 'margin' then
float.classes:insert('margin-caption')
Expand Down
7 changes: 6 additions & 1 deletion src/resources/filters/layout/html.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ end, function(panel_layout)
})
decorate_caption_with_crossref(float_tbl)
rendered_panel = float_reftarget_render_html_figure(float_tbl)
rendered_panel.attr = pandoc.Attr(panel_layout.identifier, {"quarto-layout-panel"})
local panel_attr = pandoc.Attr(panel_layout.identifier, {"quarto-layout-panel"})
-- https://github.com/quarto-dev/quarto-cli/issues/1173
if rendered_panel.classes:includes("margin-caption") then
panel_attr.classes:insert("margin-caption")
end
rendered_panel.attr = panel_attr
else
rendered_panel = panel
rendered_panel.attr = pandoc.Attr(
Expand Down

0 comments on commit b82d779

Please sign in to comment.