From 94b6b2b05beb502561f2a500ea362904a28f3f26 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Wed, 4 Mar 2026 13:42:30 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Migration=20022=20=E2=80=94=20Regex=20an?= =?UTF-8?q?=20echte=20Template-Struktur=20angepasst=20(bold-headings)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/apply_block_markers_022.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/apply_block_markers_022.py b/scripts/apply_block_markers_022.py index b3f3091..c3baa50 100644 --- a/scripts/apply_block_markers_022.py +++ b/scripts/apply_block_markers_022.py @@ -67,21 +67,32 @@ def wrap_block(content: str, block_id: str, pattern: str, flags: int = re.MULTIL # ───────────────────────────────────────────────────────────────────────────── def apply_nda_penalty_block(content: str) -> tuple[str, int]: - """Wraps the Vertragsstrafe section in NDA templates.""" - # Match: section header containing "Vertragsstrafe" up to the next ## section or end - pattern = r'(^## \d+[\.:]?\s+[^\n]*[Vv]ertragsstrafe[^\n]*\n)(.*?)(?=^## \d+|\Z)' + """Wraps the Vertragsstrafe section in NDA templates. + + Matches bold-style heading: **N. Vertragsstrafe ...** + up to the next bold-numbered section or end of string. + """ + pattern = r'(\*\*\d+\.\s+[^\n]*[Vv]ertragsstrafe[^\n]*\*\*\n)(.*?)(?=\*\*\d+\.|\Z)' return wrap_block(content, 'NDA_PENALTY_BLOCK', pattern) def apply_cookie_analytics_block(content: str) -> tuple[str, int]: - """Wraps the ### Analyse section in Cookie Banner templates.""" - pattern = r'(^### Analyse\b[^\n]*\n)(.*?)(?=^###|\Z)' + """Wraps the Analyse section in Cookie Banner templates. + + Matches: **Abschnitt „Analyse":** + up to the next **Abschnitt or end of string. + """ + pattern = r'(\*\*Abschnitt\s+[^\n]*Analyse[^\n]*\*\*[^\n]*\n)(.*?)(?=\*\*Abschnitt\s+[^\n]*Marketing|\Z)' return wrap_block(content, 'COOKIE_ANALYTICS_BLOCK', pattern) def apply_cookie_marketing_block(content: str) -> tuple[str, int]: - """Wraps the ### Marketing section in Cookie Banner templates.""" - pattern = r'(^### Marketing\b[^\n]*\n)(.*?)(?=^###|\Z)' + """Wraps the Marketing section in Cookie Banner templates. + + Matches: **Abschnitt „Marketing":** + up to the next double-newline section divider or --- or end. + """ + pattern = r'(\*\*Abschnitt\s+[^\n]*Marketing[^\n]*\*\*[^\n]*\n)(.*?)(?=\n---|\n\*\*[A-Z]\)|\Z)' return wrap_block(content, 'COOKIE_MARKETING_BLOCK', pattern)