diff --git a/klausur-service/backend/grid_editor_api.py b/klausur-service/backend/grid_editor_api.py index 6748d68..cd53087 100644 --- a/klausur-service/backend/grid_editor_api.py +++ b/klausur-service/backend/grid_editor_api.py @@ -961,6 +961,21 @@ async def _build_grid_core( ipa_target_cols: set = set() all_content_cols: set = set() skip_ipa = (ipa_mode == "none") + + # When ipa_mode=none, strip ALL square brackets from ALL content columns + if skip_ipa: + _SQUARE_BRACKET_RE_NONE = re.compile(r'\s*\[[^\]]+\]') + for cell in all_cells: + ct = cell.get("col_type", "") + if not ct.startswith("column_"): + continue + text = cell.get("text", "") + if "[" in text: + stripped = _SQUARE_BRACKET_RE_NONE.sub("", text) + if stripped != text: + cell["text"] = stripped.strip() + cell["_ipa_corrected"] = True + if not skip_ipa and total_cols >= 3: # Detect English headword column via IPA signals (brackets or garbled). col_ipa_count: Dict[str, int] = {}