Loading generateBaseline/postprocessing.py +16 −1 Original line number Diff line number Diff line Loading @@ -2910,11 +2910,26 @@ def update_equation_style(docx_input, docx_output): # Loop over all elements to find "Equation" and change to "EQ" for equation in root.xpath('.//m:oMath', namespaces=ns): p = equation.getparent() # Surrounding paragraph p = equation while p is not None and p.tag != f"{{{ns['w']}}}p": p = p.getparent() if p is None: continue pStyle = p.xpath('./w:pPr/w:pStyle', namespaces=ns) if pStyle: current_style = pStyle[0].get(f"{{{ns['w']}}}val") # Do not overwrite Example/Note Styles if current_style in ["EW", "NO", "TAN"]: continue pStyle[0].set(f"{{{ns['w']}}}val", new_style) counter += 1 print(f'Changed style "Equation" to "EQ" {counter} times') Loading Loading
generateBaseline/postprocessing.py +16 −1 Original line number Diff line number Diff line Loading @@ -2910,11 +2910,26 @@ def update_equation_style(docx_input, docx_output): # Loop over all elements to find "Equation" and change to "EQ" for equation in root.xpath('.//m:oMath', namespaces=ns): p = equation.getparent() # Surrounding paragraph p = equation while p is not None and p.tag != f"{{{ns['w']}}}p": p = p.getparent() if p is None: continue pStyle = p.xpath('./w:pPr/w:pStyle', namespaces=ns) if pStyle: current_style = pStyle[0].get(f"{{{ns['w']}}}val") # Do not overwrite Example/Note Styles if current_style in ["EW", "NO", "TAN"]: continue pStyle[0].set(f"{{{ns['w']}}}val", new_style) counter += 1 print(f'Changed style "Equation" to "EQ" {counter} times') Loading