Loading generateBaseline/postprocessing.py +10 −4 Original line number Diff line number Diff line Loading @@ -964,7 +964,7 @@ def update_unnumbered_lists(docx_input, docx_output): if id(para) in processed_paras: continue if para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns) and para.xpath('./w:pPr/w:numPr', namespaces=ns): if (para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns) or not para.xpath('./w:pPr/w:pStyle', namespaces=ns)) and para.xpath('./w:pPr/w:numPr', namespaces=ns): # 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 Loading @@ -979,10 +979,16 @@ def update_unnumbered_lists(docx_input, docx_output): pPr.append(pStyle) counter_numbered += 1 else: # Change Compact style to B1, B2 or B3 style compact_style = para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns)[0] # Get pPr element to remove numPr from it # Change Compact style if exists to B1, B2 or B3 style # Get pPr element to work with styles/numPr pPr = para.xpath('./w:pPr', namespaces=ns)[0] # Try to get existing Compact style; if not present, create pStyle compact_style_elems = pPr.xpath('./w:pStyle[@w:val="Compact"]', namespaces=ns) if compact_style_elems: compact_style = compact_style_elems[0] else: compact_style = OxmlElement('w:pStyle') pPr.insert(0, compact_style) if para.xpath('./w:pPr/w:numPr/w:ilvl[@w:val="0"]', namespaces=ns): if para.xpath('ancestor::w:tbl', namespaces=ns): Loading Loading
generateBaseline/postprocessing.py +10 −4 Original line number Diff line number Diff line Loading @@ -964,7 +964,7 @@ def update_unnumbered_lists(docx_input, docx_output): if id(para) in processed_paras: continue if para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns) and para.xpath('./w:pPr/w:numPr', namespaces=ns): if (para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns) or not para.xpath('./w:pPr/w:pStyle', namespaces=ns)) and para.xpath('./w:pPr/w:numPr', namespaces=ns): # 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 Loading @@ -979,10 +979,16 @@ def update_unnumbered_lists(docx_input, docx_output): pPr.append(pStyle) counter_numbered += 1 else: # Change Compact style to B1, B2 or B3 style compact_style = para.xpath('./w:pPr/w:pStyle[@w:val="Compact"]', namespaces=ns)[0] # Get pPr element to remove numPr from it # Change Compact style if exists to B1, B2 or B3 style # Get pPr element to work with styles/numPr pPr = para.xpath('./w:pPr', namespaces=ns)[0] # Try to get existing Compact style; if not present, create pStyle compact_style_elems = pPr.xpath('./w:pStyle[@w:val="Compact"]', namespaces=ns) if compact_style_elems: compact_style = compact_style_elems[0] else: compact_style = OxmlElement('w:pStyle') pPr.insert(0, compact_style) if para.xpath('./w:pPr/w:numPr/w:ilvl[@w:val="0"]', namespaces=ns): if para.xpath('ancestor::w:tbl', namespaces=ns): Loading