Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: \f form feed character ({{< pagebreak >}}) not valid in PowerPoint (pptx) #11896

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

mcanouil
Copy link
Collaborator

@mcanouil mcanouil commented Jan 18, 2025

Ensure that the pagebreak shortcode does not disrupt PowerPoint rendering by returning an empty paragraph instead of causing issues with a form feed character.

Fixes #11893.

Is there a way to test OpenXML document integrity in Quarto?

@mcanouil mcanouil self-assigned this Jan 18, 2025
@mcanouil mcanouil changed the title fix: \f form feed character not valid in Powerpoint fix: \f form feed character ({{< pagebreak >}} not valid in PowerPoint (pptx) Jan 18, 2025
@mcanouil mcanouil changed the title fix: \f form feed character ({{< pagebreak >}} not valid in PowerPoint (pptx) fix: \f form feed character ({{< pagebreak >}}) not valid in PowerPoint (pptx) Jan 18, 2025
@cderv
Copy link
Collaborator

cderv commented Jan 20, 2025

Thanks ! Indeed pptx was not handled. Should we just ignore pagegreak by returning an empty list ?

This would ignore the pagebreak effect in powerpoint I think.

Is there a way to test OpenXML document integrity in Quarto?

Yes we have function for testing PPTX content : ensurePptxXpath, ensurePptxLayout, ensurePptxMaxSlides, ensurePptxRegexMatches. You can usually check in verify.ts what we have available.

Look at examples in tests/** using those functions.

@mcanouil
Copy link
Collaborator Author

mcanouil commented Jan 20, 2025

Sorry, but those functions do not seem to check the overall document integrity or are they? I mean like checking that the document does not raise an error popup when it is opened.

Should we just ignore pagegreak by returning an empty list ?

I thought about this approach but also thought that adding the exception with the specific solution for the formats makes it easier to maintain/check.

Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean like checking that the document does not raise an error popup when it is opened.

Oh sorry. I misunderstood. No they do not. I don't know if this can be check (i.e. testing it opens ok). We don't check this either for PDF output.

I think we have an issue about validating Open XML produced (same way as Pandoc does it for Word). But I don't know if it works the same for PPTX.
Edit: this one

src/resources/filters/quarto-pre/shortcodes-handlers.lua Outdated Show resolved Hide resolved
Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still add some test that checks maybe

  • Number of slides is as expected
  • Content where pagebreak happens does nothing

Something like

---
title: Test pagebreak in pptx
format: pptx
---

# Slide 

Before

{{< pagebreak >}}

After

should be equivalent in content to

---
title: Test pagebreak in pptx
format: pptx
---

# Slide 

Before

{{< pagebreak >}}

After

For Docx we have snapshot test, but not for pptx yet. But checking small part of output is probably better for the long run.

If you prefer, I can add the test.

Copy link
Collaborator

@cderv cderv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still add some test that checks maybe

  • Number of slides is as expected
  • Content where pagebreak happens does nothing

Something like

---
title: Test pagebreak in pptx
format: pptx
---

# Slide 

Before

{{< pagebreak >}}

After

should be equivalent in content to

---
title: Test pagebreak in pptx
format: pptx
---

# Slide 

Before

{{< pagebreak >}}

After

For Docx we have snapshot test, but not for pptx yet. But checking small part of output is probably better for the long run.

If you prefer, I can add the test.

@mcanouil
Copy link
Collaborator Author

I see what tests to add, but if you have the time, probably faster for you to add them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pagebreak breaks PowerPoint
2 participants