File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed
src/resources/filters/customnodes Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,10 @@ _quarto.ast.add_renderer("DecoratedCodeBlock",
9595 -- further, otherwise generate the listing div and return it
9696 if not param (" listings" , false ) then
9797 local listingDiv = pandoc .Div ({})
98- local position = " "
99- if _quarto .format .isBeamerOutput () then
100- -- Adjust default float positionment for beamer (#5536)
101- position = " [H]"
102- end
98+ -- Adjust default float positionment for beamer (#5536)
99+ -- Adjust default float positionment for code blocks that request it (#12344)
100+ local needs_hold = _quarto .format .isBeamerOutput () or node .hold
101+ local position = needs_hold and " [H]" or " "
103102 listingDiv .content :insert (pandoc .RawBlock (" latex" , " \\ begin{codelisting}" .. position ))
104103
105104 local captionContent = node .caption
Original file line number Diff line number Diff line change @@ -89,8 +89,23 @@ _quarto.ast.add_handler({
8989 -- construct a minimal rows-cells div scaffolding
9090 -- so contents are properly stored in the cells slot
9191
92+ -- #12344: if there are decoratedcodeblocks inside the layout,
93+ -- we need to ask them to render themselves as [H] or we'll get outer par mode errors.
94+ local layout = tbl .layout
95+ if quarto .format .isLatexOutput () then
96+ layout = pandoc .List (tbl .layout ):map (function (lst )
97+ return pandoc .List (lst ):map (function (cell )
98+ return _quarto .ast .walk (cell , {
99+ DecoratedCodeBlock = function (decorated )
100+ decorated .hold = true
101+ return decorated
102+ end
103+ })
104+ end )
105+ end )
106+ end
92107 local rows_div = pandoc .Div ({})
93- for i , row in ipairs (tbl . layout ) do
108+ for i , row in ipairs (layout ) do
94109 local row_div = pandoc .Div (row )
95110 if tbl .is_float_reftarget then
96111 row_div = _quarto .ast .walk (row_div , {
You can’t perform that action at this time.
0 commit comments