Skip to content

Commit

Permalink
pptx - add a cleanup finalize step to remove RawBlock different from …
Browse files Browse the repository at this point in the history
…openxml

Pandoc may have an issue in its writer as, like other formats it will correctly ignore other format RawBlock, but it seems to mess the created pptx file (e.g. choosing the wrong layout, creating empty new slides)
  • Loading branch information
cderv committed May 15, 2024
1 parent b35914c commit 35e33d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/resources/filters/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import("./quarto-finalize/meta-cleanup.lua")
import("./quarto-finalize/coalesceraw.lua")
import("./quarto-finalize/descaffold.lua")
import("./quarto-finalize/typst.lua")
import("./quarto-finalize/pptx.lua")

import("./normalize/flags.lua")
import("./normalize/normalize.lua")
Expand Down Expand Up @@ -392,7 +393,8 @@ local quarto_finalize_filters = {
flags = { "has_output_cells" }
},
{ name = "finalize-wrapped-writer", filter = wrapped_writer() },
{ name = "finalize-typst-state", filter = setup_typst_state() }
{ name = "finalize-typst-state", filter = setup_typst_state() },
{ name = "finalize-pptx-raw-cleanup", filter = pptx_raw_cleanup() }
}

local quarto_layout_filters = {
Expand Down
16 changes: 16 additions & 0 deletions src/resources/filters/quarto-finalize/pptx.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
function pptx_raw_cleanup()
if not _quarto.format.isPowerPointOutput() then
return {}
end
return {
-- Remove any non-openxml RawBlock as it seems to mess pandoc Powerpoint writer
-- https://github.com/quarto-dev/quarto-cli/issues/9680
-- https://github.com/quarto-dev/quarto-cli/issues/9681
RawBlock = function(el)
if el.format ~= "openxml" then
return {}
end
return el
end
}
end

0 comments on commit 35e33d8

Please sign in to comment.