From d26744ac5e283c6c57433e4b9c9f418e8ee622c8 Mon Sep 17 00:00:00 2001 From: Iason Gavriilidis Date: Mon, 12 Jun 2023 14:49:13 +0300 Subject: [PATCH] Prevent corrupted pptx compilation When a translation contains less parts (separate by tags) the remaining parts of the source, that are present in the source file, must be removed from the xml. Until now the removal was removing the text element by itself () leaving other elements intact. This resulted in the presence of some blocks that had not content in them and should be the reason why the pptx files is considered corrupted. With this commit instead of removeing the element only we instead remove the surround block all together that will lead to compilation of non corrupted files. --- openformats/formats/pptx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openformats/formats/pptx.py b/openformats/formats/pptx.py index f9aff103..ff0f1e2c 100644 --- a/openformats/formats/pptx.py +++ b/openformats/formats/pptx.py @@ -329,7 +329,8 @@ def remove_hyperlink(cls, text_element): @classmethod def remove_text_element(cls, text_element): - text_element.decompose() + parent = text_element.find_parent('a:r') + parent.decompose() @classmethod def set_rtl_orientation(cls, paragraph):