Loading generateBaseline/postprocessing_styling.py +3 −3 Original line number Original line Diff line number Diff line Loading @@ -232,7 +232,7 @@ def update_heading_styles(docx_input, docx_output): counter_annex = 0 counter_annex = 0 h6_counter = 0 h6_counter = 0 # Find all paragraphs with heading styles (Heading1, Heading2, etc.) # Find all paragraphs with heading styles (Heading1, Heading2, etc.) for para in root.xpath('.//w:p[w:pPr/w:pStyle[starts-with(@w:val, "Heading")]]', namespaces=ns): for para in root.xpath('.//w:p[w:pPr/w:pStyle[starts-with(@w:val, "Heading") or starts-with(@w:val, "berschrift")]]', namespaces=ns): # Get all runs in this paragraph # Get all runs in this paragraph runs = para.xpath('.//w:r', namespaces=ns) runs = para.xpath('.//w:r', namespaces=ns) if not runs: if not runs: Loading Loading @@ -1171,7 +1171,7 @@ def update_abbreviations(docx_input, docx_output): counter = 0 counter = 0 # Find all paragraphs with BodyText style # Find all paragraphs with BodyText style paragraphs_to_process = root.xpath('.//w:p[w:pPr/w:pStyle[@w:val="BodyText"]]', namespaces=ns) paragraphs_to_process = root.xpath('.//w:p[w:pPr/w:pStyle[@w:val="BodyText" or @w:val="Textkrper"]]', namespaces=ns) for para in paragraphs_to_process: for para in paragraphs_to_process: # Check if this paragraph contains runs with Verbatim or VerbatimChar style # Check if this paragraph contains runs with Verbatim or VerbatimChar style Loading Loading @@ -1405,7 +1405,7 @@ def update_body_text_style(docx_input, docx_output): # Loop over all elements to find "BodyText" and "FirstParagraph" and change to "Normal" # Loop over all elements to find "BodyText" and "FirstParagraph" and change to "Normal" # Combine both XPath queries # Combine both XPath queries body_text_elems = root.xpath('.//w:pStyle[@w:val="BodyText"]', namespaces=ns) body_text_elems = root.xpath('.//w:pStyle[@w:val="BodyText" or @w:val="Textkrper"]', namespaces=ns) first_para_elems = root.xpath('.//w:pStyle[@w:val="FirstParagraph"]', namespaces=ns) first_para_elems = root.xpath('.//w:pStyle[@w:val="FirstParagraph"]', namespaces=ns) all_elems = body_text_elems + first_para_elems all_elems = body_text_elems + first_para_elems Loading Loading
generateBaseline/postprocessing_styling.py +3 −3 Original line number Original line Diff line number Diff line Loading @@ -232,7 +232,7 @@ def update_heading_styles(docx_input, docx_output): counter_annex = 0 counter_annex = 0 h6_counter = 0 h6_counter = 0 # Find all paragraphs with heading styles (Heading1, Heading2, etc.) # Find all paragraphs with heading styles (Heading1, Heading2, etc.) for para in root.xpath('.//w:p[w:pPr/w:pStyle[starts-with(@w:val, "Heading")]]', namespaces=ns): for para in root.xpath('.//w:p[w:pPr/w:pStyle[starts-with(@w:val, "Heading") or starts-with(@w:val, "berschrift")]]', namespaces=ns): # Get all runs in this paragraph # Get all runs in this paragraph runs = para.xpath('.//w:r', namespaces=ns) runs = para.xpath('.//w:r', namespaces=ns) if not runs: if not runs: Loading Loading @@ -1171,7 +1171,7 @@ def update_abbreviations(docx_input, docx_output): counter = 0 counter = 0 # Find all paragraphs with BodyText style # Find all paragraphs with BodyText style paragraphs_to_process = root.xpath('.//w:p[w:pPr/w:pStyle[@w:val="BodyText"]]', namespaces=ns) paragraphs_to_process = root.xpath('.//w:p[w:pPr/w:pStyle[@w:val="BodyText" or @w:val="Textkrper"]]', namespaces=ns) for para in paragraphs_to_process: for para in paragraphs_to_process: # Check if this paragraph contains runs with Verbatim or VerbatimChar style # Check if this paragraph contains runs with Verbatim or VerbatimChar style Loading Loading @@ -1405,7 +1405,7 @@ def update_body_text_style(docx_input, docx_output): # Loop over all elements to find "BodyText" and "FirstParagraph" and change to "Normal" # Loop over all elements to find "BodyText" and "FirstParagraph" and change to "Normal" # Combine both XPath queries # Combine both XPath queries body_text_elems = root.xpath('.//w:pStyle[@w:val="BodyText"]', namespaces=ns) body_text_elems = root.xpath('.//w:pStyle[@w:val="BodyText" or @w:val="Textkrper"]', namespaces=ns) first_para_elems = root.xpath('.//w:pStyle[@w:val="FirstParagraph"]', namespaces=ns) first_para_elems = root.xpath('.//w:pStyle[@w:val="FirstParagraph"]', namespaces=ns) all_elems = body_text_elems + first_para_elems all_elems = body_text_elems + first_para_elems Loading