@@ -243,6 +243,11 @@ function create_custom_node_scaffold(t, context)
243243 return result
244244end
245245
246+
247+ local ptype = pandoc .utils .type
248+ local InlinesMT = getmetatable (pandoc .Inlines {})
249+ local BlocksMT = getmetatable (pandoc .Blocks {})
250+
246251function create_emulated_node (t , tbl , context , forwarder )
247252 local result = create_custom_node_scaffold (t , context )
248253 tbl .t = t -- set t always to custom ast type
@@ -340,26 +345,27 @@ _quarto.ast = {
340345 end
341346 local node = node_accessor (table )
342347 local t = pandoc .utils .type (value )
343- -- FIXME this is broken; that can only be "Block", "Inline", etc
344- if t == " Div" or t == " Span" then
345- local custom_data , t , kind = _quarto .ast .resolve_custom_data (value )
346- if custom_data ~= nil then
347- value = custom_data
348- end
349- end
348+ quarto_assert (t ~= ' Div' and t ~= ' Span' , " " )
350349 if index > # node .content then
351350 _quarto .ast .grow_scaffold (node , index )
352351 end
353- local pt = pandoc .utils .type (node .content [index ])
354- if pt == " Block" then
355- node .content [index ].content =
356- _quarto .modules .attribcheck .ensure_blocks (value )
357- elseif pt == " Inline" then
358- node .content [index ].content =
359- _quarto .modules .attribcheck .ensure_inlines (value )
352+ local inner_node = node .content [index ]
353+ quarto_assert (inner_node ~= nil )
354+ if t == " Block" then
355+ inner_node .content = quarto .utils .as_blocks (value )
356+ elseif t == " Inline" then
357+ inner_node .content = quarto .utils .as_inlines (value )
360358 else
361- warn (' Cannot handle type ' .. pt )
362- node .content [index ].content = value
359+ local innertype = pandoc .utils .type (inner_node )
360+ if innertype == ' Block' then
361+ inner_node .content = quarto .utils .as_blocks (value )
362+ elseif innertype == ' Inline' then
363+ inner_node .content = quarto .utils .as_inlines (value )
364+ else
365+ warn (' Cannot find the right content type for value ' .. t )
366+ warn (debug.traceback ())
367+ inner_node .content = value
368+ end
363369 end
364370 end
365371 }
0 commit comments