Loading generateBaseline/postprocessing.py +4 −2 Changes for generateBaseline/postprocessing.py: 4 added lines, 2 removed lines. Original line number Original line Diff line number Diff line Loading @@ -1098,17 +1098,19 @@ def update_lists(docx_input, docx_output): compact_style.set(f"{{{ns['w']}}}val", "B1") compact_style.set(f"{{{ns['w']}}}val", "B1") else: else: #print(f'Found text belonging to a numbered list item') # Take the text from the paragraph # Take the text from the paragraph text = get_para_text(para) text = get_para_text(para) print(f'Found text belonging to a numbered list item: {text}') # Insert it as new run to the previous paragraph. New run starting by <w:br/> # Insert it as new run to the previous paragraph. New run starting by <w:br/> previous_para = para.getprevious() previous_para = para.getprevious() if previous_para is not None: if previous_para is not None: new_run = OxmlElement('w:r') new_run = OxmlElement('w:r') new_run.append(OxmlElement('w:br')) text_t = OxmlElement('w:t') text_t = OxmlElement('w:t') text_t.text = text text_t.text = text new_run.append(text_t) new_run.append(text_t) break_run = OxmlElement('w:r') break_run.append(OxmlElement('w:br')) previous_para.append(break_run) previous_para.append(new_run) previous_para.append(new_run) # Remove the original paragraph # Remove the original paragraph para.getparent().remove(para) para.getparent().remove(para) Loading Loading
generateBaseline/postprocessing.py +4 −2 Changes for generateBaseline/postprocessing.py: 4 added lines, 2 removed lines. Original line number Original line Diff line number Diff line Loading @@ -1098,17 +1098,19 @@ def update_lists(docx_input, docx_output): compact_style.set(f"{{{ns['w']}}}val", "B1") compact_style.set(f"{{{ns['w']}}}val", "B1") else: else: #print(f'Found text belonging to a numbered list item') # Take the text from the paragraph # Take the text from the paragraph text = get_para_text(para) text = get_para_text(para) print(f'Found text belonging to a numbered list item: {text}') # Insert it as new run to the previous paragraph. New run starting by <w:br/> # Insert it as new run to the previous paragraph. New run starting by <w:br/> previous_para = para.getprevious() previous_para = para.getprevious() if previous_para is not None: if previous_para is not None: new_run = OxmlElement('w:r') new_run = OxmlElement('w:r') new_run.append(OxmlElement('w:br')) text_t = OxmlElement('w:t') text_t = OxmlElement('w:t') text_t.text = text text_t.text = text new_run.append(text_t) new_run.append(text_t) break_run = OxmlElement('w:r') break_run.append(OxmlElement('w:br')) previous_para.append(break_run) previous_para.append(new_run) previous_para.append(new_run) # Remove the original paragraph # Remove the original paragraph para.getparent().remove(para) para.getparent().remove(para) Loading