Commit 83a0b5b9 authored by Jonas Schüppen's avatar Jonas Schüppen
Browse files

Small fixes

parent 2fb276c1
Loading
Loading
Loading
Loading
Loading
−17
Changes for generateBaseline/postprocessing.py: 0 added lines, 17 removed lines.
Original line number Original line Diff line number Diff line
@@ -2163,7 +2163,6 @@ def update_abbreviations(docx_input, docx_output):


    # 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"]]', 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
        verbatim_runs = para.xpath('./w:r[w:rPr/w:rStyle[@w:val="Verbatim" or @w:val="VerbatimChar"]]', namespaces=ns)
        verbatim_runs = para.xpath('./w:r[w:rPr/w:rStyle[@w:val="Verbatim" or @w:val="VerbatimChar"]]', namespaces=ns)
@@ -2849,22 +2848,6 @@ def add_break_after_code_blocks_and_tables(docx_input, docx_output):
            return None
            return None
        return style_elems[0].get(w_val)
        return style_elems[0].get(w_val)


    def _paragraph_text(elem):
        if elem is None or elem.tag != w_p:
            return ""
        # Build text from runs to respect how headings are created in update_heading_styles:
        # number + <w:tab/> + title in separate run parts.
        parts = []
        for run in elem.xpath('./w:r', namespaces=ns):
            for child in run:
                if child.tag == f"{{{ns['w']}}}t" and child.text:
                    parts.append(child.text)
                elif child.tag in (f"{{{ns['w']}}}tab", f"{{{ns['w']}}}br"):
                    parts.append(" ")
        # Fallback for paragraphs containing text in non-direct run descendants.
        if not parts:
            parts = elem.xpath('.//w:t/text()', namespaces=ns)
        return ''.join(parts).strip()


    def _normalize_ws(text):
    def _normalize_ws(text):
        # Normalize tabs/non-breaking spaces/multiple spaces for robust heading match.
        # Normalize tabs/non-breaking spaces/multiple spaces for robust heading match.