Loading generateBaseline/postprocessing.py +8 −5 Original line number Diff line number Diff line Loading @@ -1016,17 +1016,19 @@ def update_unnumbered_lists(docx_input, docx_output): compact_style = compact_style_elems[0] else: compact_style = OxmlElement('w:pStyle') pPr.insert(0, compact_style) # Check if it is a numbered list and get the format is_numbered, num_format = is_numbered_list(para, numbering_root) if is_numbered: # is_numbered is True if numbered, False if unnumbered, None if cannot determine pStyle = OxmlElement('w:pStyle') #pStyle = OxmlElement('w:pStyle') # If format is decimal (numbers), use BN; otherwise use BL if num_format == 'decimal': pStyle.set(f"{{{ns['w']}}}val", "BN") compact_style.set(f"{{{ns['w']}}}val", "BN") else: pStyle.set(f"{{{ns['w']}}}val", "BL") pPr.append(pStyle) compact_style.set(f"{{{ns['w']}}}val", "BL") pPr.insert(0, compact_style) # Remove numId from numPr numPr = pPr.xpath('./w:numPr', namespaces=ns)[0] numPr.remove(numPr.xpath('./w:numId', namespaces=ns)[0]) counter_numbered += 1 else: if para.xpath('./w:pPr/w:numPr/w:ilvl[@w:val="0"]', namespaces=ns): Loading Loading @@ -1059,6 +1061,7 @@ def update_unnumbered_lists(docx_input, docx_output): numPr = pPr.xpath('./w:numPr', namespaces=ns)[0] pPr.remove(numPr) counter_b3 += 1 pPr.insert(0, compact_style) counter_compact += 1 continue Loading Loading
generateBaseline/postprocessing.py +8 −5 Original line number Diff line number Diff line Loading @@ -1016,17 +1016,19 @@ def update_unnumbered_lists(docx_input, docx_output): compact_style = compact_style_elems[0] else: compact_style = OxmlElement('w:pStyle') pPr.insert(0, compact_style) # Check if it is a numbered list and get the format is_numbered, num_format = is_numbered_list(para, numbering_root) if is_numbered: # is_numbered is True if numbered, False if unnumbered, None if cannot determine pStyle = OxmlElement('w:pStyle') #pStyle = OxmlElement('w:pStyle') # If format is decimal (numbers), use BN; otherwise use BL if num_format == 'decimal': pStyle.set(f"{{{ns['w']}}}val", "BN") compact_style.set(f"{{{ns['w']}}}val", "BN") else: pStyle.set(f"{{{ns['w']}}}val", "BL") pPr.append(pStyle) compact_style.set(f"{{{ns['w']}}}val", "BL") pPr.insert(0, compact_style) # Remove numId from numPr numPr = pPr.xpath('./w:numPr', namespaces=ns)[0] numPr.remove(numPr.xpath('./w:numId', namespaces=ns)[0]) counter_numbered += 1 else: if para.xpath('./w:pPr/w:numPr/w:ilvl[@w:val="0"]', namespaces=ns): Loading Loading @@ -1059,6 +1061,7 @@ def update_unnumbered_lists(docx_input, docx_output): numPr = pPr.xpath('./w:numPr', namespaces=ns)[0] pPr.remove(numPr) counter_b3 += 1 pPr.insert(0, compact_style) counter_compact += 1 continue Loading