fix(msword): Fixing function return in equations handling (#1194)
* Fixing function return Signed-off-by: Rafael Teixeira de Lima <Rafael.td.lima@gmail.com> * Add message Signed-off-by: Rafael Teixeira de Lima <Rafael.td.lima@gmail.com> --------- Signed-off-by: Rafael Teixeira de Lima <Rafael.td.lima@gmail.com>
This commit is contained in:
parent
1d680b0a32
commit
0b707d0882
@ -275,8 +275,10 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend):
|
|||||||
only_equations.append(latex_equation)
|
only_equations.append(latex_equation)
|
||||||
texts_and_equations.append(latex_equation)
|
texts_and_equations.append(latex_equation)
|
||||||
|
|
||||||
if "".join(only_texts) != text:
|
if "".join(only_texts).strip() != text.strip():
|
||||||
return text
|
# If we are not able to reconstruct the initial raw text
|
||||||
|
# do not try to parse equations and return the original
|
||||||
|
return text, []
|
||||||
|
|
||||||
return "".join(texts_and_equations), only_equations
|
return "".join(texts_and_equations), only_equations
|
||||||
|
|
||||||
@ -365,6 +367,7 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend):
|
|||||||
for eq in equations:
|
for eq in equations:
|
||||||
if len(text_tmp) == 0:
|
if len(text_tmp) == 0:
|
||||||
break
|
break
|
||||||
|
|
||||||
pre_eq_text = text_tmp.split(eq, maxsplit=1)[0]
|
pre_eq_text = text_tmp.split(eq, maxsplit=1)[0]
|
||||||
text_tmp = text_tmp.split(eq, maxsplit=1)[1]
|
text_tmp = text_tmp.split(eq, maxsplit=1)[1]
|
||||||
if len(pre_eq_text) > 0:
|
if len(pre_eq_text) > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user