mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-27 12:34:22 +00:00
Fix test_backend_msword
Signed-off-by: Rafael Teixeira de Lima <Rafael.td.lima@gmail.com>
This commit is contained in:
parent
b3b7c387ca
commit
7996dcbf3e
@ -227,13 +227,16 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend):
|
|||||||
only_texts = []
|
only_texts = []
|
||||||
texts_and_equations = []
|
texts_and_equations = []
|
||||||
for subt in element.iter():
|
for subt in element.iter():
|
||||||
if subt.tag.endswith("t") and "math" not in subt.tag:
|
tag_name = etree.QName(subt).localname
|
||||||
|
if tag_name == "t" and "math" not in subt.tag:
|
||||||
only_texts.append(subt.text)
|
only_texts.append(subt.text)
|
||||||
texts_and_equations.append(subt.text)
|
texts_and_equations.append(subt.text)
|
||||||
if "oMath" in subt.tag and "oMathPara" not in subt.tag:
|
elif "oMath" in subt.tag and "oMathPara" not in subt.tag:
|
||||||
texts_and_equations.append(f"${str(oMath2Latex(subt))}$")
|
texts_and_equations.append(f"${str(oMath2Latex(subt))}$")
|
||||||
|
|
||||||
assert "".join(only_texts) == text
|
if "".join(only_texts) != text:
|
||||||
|
return text
|
||||||
|
|
||||||
return "".join(texts_and_equations)
|
return "".join(texts_and_equations)
|
||||||
|
|
||||||
def handle_text_elements(self, element, docx_obj, doc):
|
def handle_text_elements(self, element, docx_obj, doc):
|
||||||
|
Loading…
Reference in New Issue
Block a user