@@ -336,16 +336,21 @@ _quarto.ast = {
336336 return
337337 end
338338 local node = node_accessor (table )
339- local t = pandoc .utils .type (value )
340- quarto_assert (t ~= ' Div' and t ~= ' Span' , " " )
339+ local valtype = pandoc .utils .type (value )
340+ quarto_assert (valtype ~= ' Div' and valtype ~= ' Span' , " " )
341341 if index > # node .content then
342342 _quarto .ast .grow_scaffold (node , index )
343343 end
344- local pt = pandoc .utils .type (value )
345- if pt == " Block" or pt == " Inline" then
346- node .content [index ].content = {value }
344+ local inner_node = node .content [index ]
345+ local innertype = pandoc .utils .type (inner_node )
346+ if innertype == ' Block' then
347+ inner_node .content = quarto .utils .as_blocks (value )
348+ elseif innertype == ' Inline' then
349+ inner_node .content = quarto .utils .as_inlines (value )
347350 else
348- node .content [index ].content = value
351+ warn (debug.traceback (
352+ ' Cannot find the right content type for value ' .. valtype ))
353+ inner_node .content = value
349354 end
350355 end
351356 }
@@ -416,13 +421,15 @@ _quarto.ast = {
416421 -- luacov: enable
417422 end
418423
419- local forwarder = { }
424+ local forwarder
420425 if tisarray (handler .slots ) then
426+ forwarder = pandoc .List {}
421427 for i , slot in ipairs (handler .slots ) do
422428 forwarder [slot ] = i
423429 end
424- else
425- forwarder = handler .slots
430+ elseif handler .slots ~= nil then
431+ warn (' Expected `slots` to be either an array or nil, got ' ..
432+ tostring (handler .slots ))
426433 end
427434
428435 quarto [handler .ast_name ] = function (params )
0 commit comments