Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/resources/filters/common/pandoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ function combineFilters(filters)
for _, fn in ipairs(fns) do
local result = fn(current)
if result ~= nil then
if (pandoc.utils.type(result) ~= pandoc.utils.type(current) or
result.t ~= current.t) then
-- luacov: disable
quarto.log.info("combineFilters: expected " .. (current.t or pandoc.utils.type(current)) .. " got " .. (result.t or pandoc.utils.type(result)))
quarto.log.info("Exiting filter early. (This is a potential bug in Quarto.)")
return result
-- luacov: enable
end
-- if there is a result from this function
-- update the current value with the result
current = result
Expand Down
2 changes: 1 addition & 1 deletion src/resources/filters/customnodes/callout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function docx_callout_and_table_fixup()
Blocks = function(blocks)
local lastWasCallout = false
local lastWasTableOrFigure = false
local newBlocks = pandoc.List()
local newBlocks = pandoc.Blocks({})
for i,el in ipairs(blocks) do
-- determine what this block is
local isCallout = is_custom_node(el, "Callout")
Expand Down
10 changes: 5 additions & 5 deletions src/resources/filters/normalize/extractquartodom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ function parse_md_in_html_rawblocks()
return {
Div = function(div)
if div.attributes.qmd ~= nil or div.attributes["qmd-base64"] ~= nil then
return process_quarto_markdown_input_element(div)
return make_scaffold(pandoc.Div, process_quarto_markdown_input_element(div))
end
end,
Span = function(span)
if span.attributes.qmd ~= nil or span.attributes["qmd-base64"] ~= nil then
local blocks = process_quarto_markdown_input_element(span)
if #blocks < 1 then
return pandoc.Span({})
local inlines = quarto.utils.as_inlines(process_quarto_markdown_input_element(span))
if #inlines < 1 then
return make_scaffold(pandoc.Span, {})
end
return blocks[1].content
return make_scaffold(pandoc.Span, inlines)
end
end
}
Expand Down
6 changes: 5 additions & 1 deletion src/resources/filters/quarto-finalize/descaffold.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ function descaffold()
end
end
}
end
end

function make_scaffold(ctor, node)
return ctor(node or {}, pandoc.Attr("", {"quarto-scaffold", "hidden"}, {}))
end