Use EX instead of EW for examples

Merge request reports

Loading
+7 −7
Changes for generateBaseline/postprocessing.py: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -1956,7 +1956,7 @@ def update_notes(docx_input, docx_output):
    root = etree.fromstring(xml_data)
    note_style = "NO"
    note_style_table = "TAN"
    example_style = "EW"
    example_style = "EX"
    counter_no = 0
    counter_ew = 0

@@ -2037,7 +2037,7 @@ def update_notes(docx_input, docx_output):
            for child in all_children:
                para.append(child)
        elif example_match:
            # Change style to EW
            # Change style to EX
            pStyle_elem.set(f"{{{ns['w']}}}val", example_style)
            counter_ew += 1
            
@@ -2080,10 +2080,10 @@ def update_notes(docx_input, docx_output):
            for child in all_children:
                para.append(child)
        else:
            # Check whether BlockText is preceded by paragraph style "EW".
            # Check whether BlockText is preceded by paragraph style "EX".
            # Rules:
            # - if preceding paragraph style is EW -> change to PL and stop
            # - if preceding paragraph has a style and it is not EW -> stop (no change)
            # - if preceding paragraph style is EX -> change to PL and stop
            # - if preceding paragraph has a style and it is not EX -> stop (no change)
            # - if no pPr or no pStyle -> continue searching backwards
            # - if not a paragraph -> continue searching backwards
            prev_para = para.getprevious()
@@ -2107,10 +2107,10 @@ def update_notes(docx_input, docx_output):
                    # EW in the Abbreviations clause is an abbreviation entry, not an example.
                    if not _is_in_abbreviations_clause(para, ns):
                        pStyle_elem.set(f"{{{ns['w']}}}val", "PL")
                        print(f'Changed style "BlockText" to "PL" because it is preceded by a paragraph with style "EW" (line {prev_para.sourceline})')
                        print(f'Changed style "BlockText" to "PL" because it is preceded by a paragraph with style "EX" (line {prev_para.sourceline})')
                break
            
    print(f'Changed style "BlockText/Notes" to "NO" {counter_no} times and "BlockText/Examples" to "EW" {counter_ew} times')
    print(f'Changed style "BlockText/Notes" to "NO" {counter_no} times and "BlockText/Examples" to "EX" {counter_ew} times')

    xml_data = etree.tostring(root, xml_declaration=True, encoding="UTF-8", standalone="yes")
    
+1
Changes for .gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@
.python-version
toMkdocs/__pycache__
__pycache__
.idea/
Loading