Loading generateBaseline/postprocessing.py +11 −1 Changes for generateBaseline/postprocessing.py: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1877,12 +1877,22 @@ def update_lists(docx_input, docx_output): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) else: para_processed = False # Take all elements except pPr (usually only runs and hyperlinks) in this paragraph and append them to the previous paragraph. New run starting by <w:br/> previous_para = para.getprevious() if previous_para is not None and previous_para.tag == f"{{{ns['w']}}}p": if (previous_para.xpath('./w:pPr/w:pStyle[@w:val="SourceCode"]', namespaces=ns)): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) else: para_processed = True # If the previous paragraph is a list item, and is one level higher than the current, then # leave it as is (probably it belongs to a previous list item) elif previous_para.xpath('./w:pPr/w:numPr/w:ilvl', namespaces=ns): previous_ilvl = previous_para.xpath('./w:pPr/w:numPr/w:ilvl', namespaces=ns)[0].get(f"{{{ns['w']}}}val") if int(previous_ilvl) > int(ilvl): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) para_processed = True if not para_processed: break_run = OxmlElement('w:r') break_run.append(OxmlElement('w:br')) previous_para.append(break_run) Loading Loading
generateBaseline/postprocessing.py +11 −1 Changes for generateBaseline/postprocessing.py: 11 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -1877,12 +1877,22 @@ def update_lists(docx_input, docx_output): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) else: para_processed = False # Take all elements except pPr (usually only runs and hyperlinks) in this paragraph and append them to the previous paragraph. New run starting by <w:br/> previous_para = para.getprevious() if previous_para is not None and previous_para.tag == f"{{{ns['w']}}}p": if (previous_para.xpath('./w:pPr/w:pStyle[@w:val="SourceCode"]', namespaces=ns)): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) else: para_processed = True # If the previous paragraph is a list item, and is one level higher than the current, then # leave it as is (probably it belongs to a previous list item) elif previous_para.xpath('./w:pPr/w:numPr/w:ilvl', namespaces=ns): previous_ilvl = previous_para.xpath('./w:pPr/w:numPr/w:ilvl', namespaces=ns)[0].get(f"{{{ns['w']}}}val") if int(previous_ilvl) > int(ilvl): compact_style.set(f"{{{ns['w']}}}val", LIST_STYLES[ilvl]["bullet_style"]["normal"]) para_processed = True if not para_processed: break_run = OxmlElement('w:r') break_run.append(OxmlElement('w:br')) previous_para.append(break_run) Loading